1 | <?php |
||
27 | class Container implements ContainerInterface |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * @var DefinitionList |
||
32 | */ |
||
33 | protected $definitions; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | protected static $instances = []; |
||
39 | |||
40 | /** |
||
41 | * @readwrite |
||
42 | * @var ContainerInterface |
||
43 | */ |
||
44 | protected $parent; |
||
45 | |||
46 | private static $containerKeys = [ |
||
47 | 'Interop\Container\ContainerInterface', |
||
48 | 'Slick\Di\Container' |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * Initialise the container with an empty definitions list |
||
53 | */ |
||
54 | 74 | public function __construct() |
|
67 | |||
68 | /** |
||
69 | * Finds an entry of the container by its identifier and returns it. |
||
70 | * |
||
71 | * @param string $id Identifier of the entry to look for. |
||
72 | * |
||
73 | * @throws NotFoundException No entry was found for this identifier. |
||
74 | * @throws ContainerException Error while retrieving the entry. |
||
75 | * |
||
76 | * @return mixed Entry. |
||
77 | */ |
||
78 | 52 | public function get($id) |
|
97 | |||
98 | /** |
||
99 | * Returns true if the container can return an entry for the given identifier. |
||
100 | * Returns false otherwise. |
||
101 | * |
||
102 | * @param string $id Identifier of the entry to look for. |
||
103 | * |
||
104 | * @return boolean |
||
105 | */ |
||
106 | 56 | public function has($id) |
|
117 | |||
118 | /** |
||
119 | * Adds a definition or a value to the container |
||
120 | * |
||
121 | * If the $definition parameter is a scalar a Value definition is created |
||
122 | * and added to the definitions list. |
||
123 | * |
||
124 | * If the $value is a callable a factory definition will be created |
||
125 | * |
||
126 | * @param string|DefinitionInterface $definition |
||
127 | * @param mixed $value |
||
128 | * @param array $parameters |
||
129 | * @param Scope|string $scope |
||
130 | * |
||
131 | * @return $this|self |
||
132 | */ |
||
133 | 74 | public function register( |
|
160 | |||
161 | /** |
||
162 | * Creates the object for provided class name |
||
163 | * |
||
164 | * This method creates factory definition that can be retrieved from |
||
165 | * the container by using it FQ class name. |
||
166 | * |
||
167 | * If there are satisfiable dependencies in the container the are injected. |
||
168 | * |
||
169 | * @param string $className FQ class name |
||
170 | * @param array $parameters An array of constructor parameters |
||
171 | * @param string $scope The definition scope |
||
172 | * |
||
173 | * @return mixed |
||
174 | */ |
||
175 | 10 | public function make( |
|
190 | |||
191 | /** |
||
192 | * Inject known dependencies on provide object |
||
193 | * |
||
194 | * @param object $object |
||
195 | * |
||
196 | * @return mixed |
||
197 | */ |
||
198 | 46 | public function injectOn($object) |
|
208 | |||
209 | /** |
||
210 | * Set parent container for interoperability |
||
211 | * |
||
212 | * @ignoreInject |
||
213 | * @param ContainerInterface $container |
||
214 | * @return $this |
||
215 | */ |
||
216 | 70 | public function setParent(ContainerInterface $container) |
|
221 | |||
222 | /** |
||
223 | * Creates a value definition for register |
||
224 | * |
||
225 | * @param string $name The name for the definition |
||
226 | * @param mixed $value The value that the definition will resolve |
||
227 | * |
||
228 | * @return Value A Value definition object |
||
229 | */ |
||
230 | 72 | private function createValueDefinition($name, $value) |
|
239 | |||
240 | /** |
||
241 | * Creates a Factory definition |
||
242 | * |
||
243 | * @param string $name |
||
244 | * @param callable $callback |
||
245 | * @param array $params |
||
246 | * @param Scope $scope |
||
247 | * |
||
248 | * @return Factory |
||
249 | */ |
||
250 | 32 | private function createFactoryDefinition( |
|
258 | |||
259 | /** |
||
260 | * Returns the resolved object for provide definition |
||
261 | * |
||
262 | * @param DefinitionInterface $definition |
||
263 | * @return mixed|null |
||
264 | */ |
||
265 | 50 | private function resolve(DefinitionInterface $definition) |
|
272 | |||
273 | /** |
||
274 | * Resolve instances and save then for singleton use |
||
275 | * |
||
276 | * @param DefinitionInterface $definition |
||
277 | * @return mixed |
||
278 | */ |
||
279 | 46 | private function resolveSingleton(DefinitionInterface $definition) |
|
289 | |||
290 | /** |
||
291 | * Creates and registers an object definition |
||
292 | * |
||
293 | * @param string $name FQ class name |
||
294 | * @param array $parameters Constructor parameters |
||
295 | * @param string $scope Definition scope |
||
296 | * |
||
297 | * @return $this|self |
||
298 | */ |
||
299 | 4 | private function registerObject($name, $parameters, $scope) |
|
310 | |||
311 | /** |
||
312 | * Check if parent has provided key |
||
313 | * |
||
314 | * @param string $key |
||
315 | * @return bool |
||
316 | */ |
||
317 | 18 | private function parentHas($key) |
|
324 | } |
||
325 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.