Source of file Request.php

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

../src/Traits/Request.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
/**
 * Request Trait
 *
 * @category   PHP
 * @package    MvcLite
 * @subpackage Traits
 * @since      File available since release 3.0.x
 * @author     Cory Collier <corycollier@corycollier.com>
 */

namespace MvcLite\Traits;

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

    /**
     * Getter for the Request instance.
     *
     * @return MvcLite\Request The Request instance.
     */
    public function getRequest()
    {
        if (!$this->request) {
            $this->request = \MvcLite\Request::getInstance();
        }
        return $this->request;
    }
}