Source of file View.php

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

../src/Traits/View.php

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

namespace MvcLite\Traits;

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

    /**
     * Getter for the View instance variable.
     *
     * @return MvcLite\View
     */
    public function getView()
    {
        if (!$this->view) {
            $this->view = \MvcLite\View::getInstance();
        }
        return $this->view;
    }
}