1 | <?php |
||
18 | class ObjectDefinition extends \stdClass |
||
19 | { |
||
20 | /** |
||
21 | * Entry name (most of the time, same as $className). |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | private $name; |
||
26 | |||
27 | /** |
||
28 | * Class name (if null, then the class name is $name). |
||
29 | * |
||
30 | * @var string|null |
||
31 | */ |
||
32 | private $className; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | private $constructorInjection = []; |
||
38 | |||
39 | /** |
||
40 | * @var array |
||
41 | */ |
||
42 | private $methodInjections = []; |
||
43 | |||
44 | /** |
||
45 | * ObjectDefinition constructor. |
||
46 | * |
||
47 | * @param string $name Entry name |
||
48 | * @param null $className Class name |
||
49 | */ |
||
50 | public function __construct($name, $className = null) |
||
55 | |||
56 | /** |
||
57 | * @return string Class name |
||
58 | */ |
||
59 | public function getClassName() |
||
67 | |||
68 | /** |
||
69 | * @return string Entry name |
||
70 | */ |
||
71 | public function getName() |
||
75 | |||
76 | /** |
||
77 | * Add method parameters. |
||
78 | * |
||
79 | * @param $name |
||
80 | * @param array $methodInjection |
||
81 | */ |
||
82 | public function addMethodInjection($name, array $methodInjection) |
||
90 | |||
91 | /** |
||
92 | * Set property definition. |
||
93 | * |
||
94 | * @param \ReflectionProperty $property |
||
95 | * @param $target |
||
96 | */ |
||
97 | public function setPropertyInjection(\ReflectionProperty $property, $target) |
||
104 | |||
105 | /** |
||
106 | * Set constructor parameters. |
||
107 | * |
||
108 | * @param array $methodInjection |
||
109 | */ |
||
110 | public function setConstructorInjection(array $methodInjection) |
||
114 | |||
115 | /** |
||
116 | * Get method parameters. |
||
117 | * |
||
118 | * @param $name |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function getMethodParameters($name) |
||
130 | |||
131 | /** |
||
132 | * New Instance of defined class. |
||
133 | * |
||
134 | * @param bool $withConstructor |
||
135 | * |
||
136 | * @return object|\ReflectionClass |
||
137 | */ |
||
138 | public function getNewInstance($withConstructor = true) |
||
146 | } |
||
147 |