http://phing.info/

Source Code Coverage

Designed for use with PHPUnit2, Xdebug and Phing.

Methods: 2 LOC: 63 Statements: 11
Legend: executednot executeddead code
Source file Statements Methods Total coverage
Injector.php 100.0% 100.0% 100.0%
 
1
<?php
2
/**
3
 * Xyster Framework
4
 *
5
 * This source file is subject to the new BSD license that is bundled
6
 * with this package in the file LICENSE.txt.
7
 * It is also available through the world-wide-web at this URL:
8
 * http://www.opensource.org/licenses/bsd-license.php
9
 *
10
 * @category  Xyster
11
 * @package   Xyster_Controller
12
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
13
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
14
 * @version   $Id$
15
 */
16
namespace Xyster\Controller\Action;
17
/**
18
 * An injector that can be used for setter injection with a front controller
19
 *
20
 * @category  Xyster
21
 * @package   Xyster_Controller
22
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
23
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
24
 */
25
class Injector extends \Xyster\Container\Injector\Autowiring
26 1
{
27
    protected $_request;
28
    protected $_response;
29
    protected $_params;
30
    protected static $_ignoreFields = array('frontController', 'request', 'response');
31
32
    /**
33
     * Creates a new action controller injector
34
     *
35
     * @param \Xyster\Container\Definition the definition
36
     * @param Zend_Controller_Request_Abstract the request object
37
     * @param Zend_Controller_Response_Abstract the response object
38
     * @param array The invocation parameters
39
     */
40
    public function __construct(\Xyster\Container\Definition $def, \Zend_Controller_Request_Abstract $request, \Zend_Controller_Response_Abstract $response, array $params = array())
41
    {
42 2
        parent::__construct($def, \Xyster\Container\Autowire::ByType(), self::$_ignoreFields);
43 2
        $this->_request = $request;
44 2
        $this->_response = $response;
45 2
        $this->_params = $params;
46
    }
47
48
    /**
49
     * Instantiate an object with given parameters
50
     *
51
     * @param \Xyster\Type\Type $type the class to construct
52
     * @return object the new object
53
     */
54
    protected function _newInstance(\Xyster\Type\Type $type, \Xyster\Container\IContainer $container)
55
    {
56 2
        $class = $type->getClass();
57 2
        $constructor = $class ? $class->getConstructor() : null;
58
        return $constructor ?
59 2
                $class->newInstanceArgs(
60 2
                        array($this->_request, $this->_response, $this->_params)) :
61 2
                $class->newInstance();
62
    }
63 1
}


Report generated at 2010-10-18T17:19:48-04:00