Source of file Config.php

Size: 0,882 Bytes - Last Modified: 2015-12-22T09:12:14-05:00

../src/Traits/Config.php

1234567891011121314151617181920212223242526272829303132333435363738394041
Covered by 3 test(s):
  • MvcLite\DispatcherTest::testDispatch with data set "good controller request"
  • MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
  • MvcLite\ConfigTraitsTest::testGetConfig
42
Covered by 3 test(s):
  • MvcLite\DispatcherTest::testDispatch with data set "good controller request"
  • MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
  • MvcLite\ConfigTraitsTest::testGetConfig
43
Covered by 3 test(s):
  • MvcLite\DispatcherTest::testDispatch with data set "good controller request"
  • MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
  • MvcLite\ConfigTraitsTest::testGetConfig
44
Covered by 3 test(s):
  • MvcLite\DispatcherTest::testDispatch with data set "good controller request"
  • MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
  • MvcLite\ConfigTraitsTest::testGetConfig
454647
<?php
/**
 * Config Trait
 *
 * @category   PHP
 * @package    MvcLite
 * @subpackage Traits
 * @since      File available since release 3.0.x
 * @author     Cory Collier <corycollier@corycollier.com>
 */

namespace MvcLite\Traits;

/**
 * Config Trait.
 *
 * Allows a getter for the config instance.
 *
 * @category   PHP
 * @package    MvcLite
 * @subpackage Traits
 * @since      File available since release 3.0.x
 * @author     Cory Collier <corycollier@corycollier.com>
 */
trait Config
{
    /**
     * Config instance variable.
     *
     * @var MvcLite\Config
     */
    protected $config;

    /**
     * Getter for the config.
     *
     * @return Config Returns the config instance.
     */
    public function getConfig()
    {
        if (!$this->config) {
            $this->config = \MvcLite\Config::getInstance();
        }
        return $this->config;
    }
}