1 | <?php |
||
6 | class Container |
||
7 | { |
||
8 | /** |
||
9 | * |
||
10 | * @var mixed[] |
||
11 | */ |
||
12 | protected $config = array(); |
||
13 | |||
14 | /** |
||
15 | * |
||
16 | * @var \DICIT\ArrayResolver |
||
17 | */ |
||
18 | protected $parameters; |
||
19 | |||
20 | /** |
||
21 | * |
||
22 | * @var \DICIT\ArrayResolver |
||
23 | */ |
||
24 | protected $classes; |
||
25 | |||
26 | /** |
||
27 | * |
||
28 | * @var \DICIT\Registry |
||
29 | */ |
||
30 | protected $registry = null; |
||
31 | |||
32 | /** |
||
33 | * |
||
34 | * @var \DICIT\ActivatorFactory |
||
35 | */ |
||
36 | protected $activatorFactory = null; |
||
37 | |||
38 | /** |
||
39 | * |
||
40 | * @var \DICIT\InjectorFactory |
||
41 | */ |
||
42 | protected $injectorFactory = null; |
||
43 | |||
44 | /** |
||
45 | * |
||
46 | * @var \DICIT\EncapsulatorFactory |
||
47 | */ |
||
48 | protected $encapsulatorFactory = null; |
||
49 | |||
50 | /** |
||
51 | * |
||
52 | * @var \DICIT\ReferenceResolver |
||
53 | */ |
||
54 | protected $referenceResolver = null; |
||
55 | |||
56 | /** |
||
57 | * |
||
58 | * @param Config\AbstractConfig $cfg |
||
59 | * @param ActivatorFactory $activatorFactory |
||
60 | * @param InjectorFactory $injectorFactory |
||
61 | */ |
||
62 | public function __construct(Config\AbstractConfig $cfg, |
||
76 | |||
77 | /** |
||
78 | * Binds an existing object or an object definition to a key in the container. |
||
79 | * @param string $key The key to which the new object/definition should be bound. |
||
80 | * @param mixed $item An array or an object to bind. |
||
81 | * If $item is an object, it will be registered as a singleton in the |
||
82 | * object registry. Otherwise, $item will be handled as an object definition. |
||
83 | */ |
||
84 | public function bind($key, $item) |
||
93 | |||
94 | /** |
||
95 | * Set a parameter in the container on any key |
||
96 | * @param [type] $key [description] |
||
97 | * @param [type] $value [description] |
||
98 | */ |
||
99 | public function setParameter($key, $value) |
||
125 | |||
126 | /** |
||
127 | * Retrieve the parameter value configured in the container |
||
128 | * @param string $parameterName |
||
129 | * @return mixed |
||
130 | */ |
||
131 | public function getParameter($parameterName) |
||
141 | |||
142 | /** |
||
143 | * Retrieve a class configured in the container |
||
144 | * @param string $serviceName |
||
145 | * @return object |
||
146 | */ |
||
147 | public function get($serviceName) |
||
168 | |||
169 | |||
170 | public function resolve($reference) |
||
174 | |||
175 | /** |
||
176 | * Resolves an array of references. |
||
177 | * @param array $references |
||
178 | * @return array containing all the resolved references |
||
179 | */ |
||
180 | public function resolveMany(array $references = null) |
||
188 | |||
189 | /** |
||
190 | * Flush the registry |
||
191 | * @return Container |
||
192 | */ |
||
193 | public function flushRegistry() |
||
198 | |||
199 | /** |
||
200 | * Chain of command of the class loader |
||
201 | * @param array $serviceConfig |
||
202 | * @param string $serviceName |
||
203 | * @return object |
||
204 | */ |
||
205 | protected function loadService($serviceName, $serviceConfig) |
||
225 | |||
226 | /** |
||
227 | * Handles class instanciation |
||
228 | * @param array $serviceConfig |
||
229 | * @param string $serviceName |
||
230 | * @return object |
||
231 | */ |
||
232 | protected function activate($serviceName, $serviceConfig) |
||
238 | |||
239 | /** |
||
240 | * Handle method invocations in the class |
||
241 | * @param object $class |
||
242 | * @param array $serviceConfig |
||
243 | * @return boolean |
||
244 | */ |
||
245 | protected function inject($class, $serviceConfig) |
||
255 | |||
256 | /** |
||
257 | * Interceptor handler |
||
258 | * @param object $class |
||
259 | * @param array $serviceConfig |
||
260 | * @return object |
||
261 | */ |
||
262 | protected function encapsulate($class, $serviceConfig) |
||
272 | |||
273 | /** |
||
274 | * Check that the value to bind is a scalar, or an array multi-dimensional of scalars |
||
275 | * @param string $key |
||
276 | * @param mixed $value |
||
277 | * @return boolean |
||
278 | * |
||
279 | * @throws IllegalTypeException |
||
280 | * |
||
281 | */ |
||
282 | protected function validateParameter($key, $value) |
||
303 | } |
||
304 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..