<?php
/**
 * Shop Config
 *
 * $Id$
 *
 * @author gERD Schaufelberger <gerd@php-tools.net>
 * @license PHP License
 * @package WB
 * @subpackage base
 */

/**
 * Shop Config
 *
 *
 * @version 0.1.0
 * @package WB
 * @subpackage base
 * @deprecated in favour of ValueAce
 */
class WBShop_Config extends WBStdClass
{
    /**
     * Current object
     * @var WBShop_Config
     */
    private static $singleton;

    /**
     *
     * @var WBConfig
     */
    private $config;

    /**
     * Constructor
     *
     * Private constructor to implement singleton
     */
    private function __construct()
    {
        $this->config   =   WBClass::create('WBConfig');
        $this->config->load('shop/config');
    }

    /**
     * Singleton
     *
     * @return WBShop_Config
     */
    public static function singleton()
    {
        if (self::$singleton) {
            return self::$singleton;
        }

        self::$singleton    =   new WBShop_Config();
        return self::$singleton;
    }

    /**
     * Raw access to config values
     */
    private function get($path = null, $default = null)
    {
        return $this->config->get($path, $default);
    }

    /**
     * Get table name for shopping items
     *
     * @return string
     */
    public function getItemTable()
    {
        return $this->config->get('system/itemtable', 'shoparticle');
    }
}