1 | <?php |
||
15 | class Container implements ContainerInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var \League\Container\Definition\DefinitionFactoryInterface |
||
19 | */ |
||
20 | protected $definitionFactory; |
||
21 | |||
22 | /** |
||
23 | * @var \League\Container\Definition\DefinitionInterface[] |
||
24 | */ |
||
25 | protected $definitions = []; |
||
26 | |||
27 | /** |
||
28 | * @var \League\Container\Definition\DefinitionInterface[] |
||
29 | */ |
||
30 | protected $sharedDefinitions = []; |
||
31 | |||
32 | /** |
||
33 | * @var \League\Container\Inflector\InflectorAggregateInterface |
||
34 | */ |
||
35 | protected $inflectors; |
||
36 | |||
37 | /** |
||
38 | * @var \League\Container\ServiceProvider\ServiceProviderAggregateInterface |
||
39 | */ |
||
40 | protected $providers; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $shared = []; |
||
46 | |||
47 | /** |
||
48 | * @var \Interop\Container\ContainerInterface[] |
||
49 | */ |
||
50 | protected $delegates = []; |
||
51 | |||
52 | /** |
||
53 | * Constructor. |
||
54 | * |
||
55 | * @param \League\Container\ServiceProvider\ServiceProviderAggregateInterface|null $providers |
||
56 | * @param \League\Container\Inflector\InflectorAggregateInterface|null $inflectors |
||
57 | * @param \League\Container\Definition\DefinitionFactoryInterface|null $definitionFactory |
||
58 | */ |
||
59 | 36 | public function __construct( |
|
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | 24 | public function get($alias, array $args = []) |
|
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | 18 | public function has($alias) |
|
118 | |||
119 | /** |
||
120 | * Returns a boolean to determine if the container has a shared instance of an alias. |
||
121 | * |
||
122 | * @param string $alias |
||
123 | * @param boolean $resolved |
||
124 | * @return boolean |
||
125 | */ |
||
126 | 30 | public function hasShared($alias, $resolved = false) |
|
132 | |||
133 | /** |
||
134 | * {@inheritdoc} |
||
135 | */ |
||
136 | 24 | public function add($alias, $concrete = null, $share = false) |
|
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | 15 | public function share($alias, $concrete = null) |
|
165 | |||
166 | /** |
||
167 | * {@inheritdoc} |
||
168 | */ |
||
169 | 6 | public function addServiceProvider($provider) |
|
175 | |||
176 | /** |
||
177 | * {@inheritdoc} |
||
178 | */ |
||
179 | 6 | public function extend($alias) |
|
197 | |||
198 | /** |
||
199 | * {@inheritdoc} |
||
200 | */ |
||
201 | public function inflector($type, callable $callback = null) |
||
205 | |||
206 | /** |
||
207 | * {@inheritdoc} |
||
208 | */ |
||
209 | public function call(callable $callable, array $args = []) |
||
213 | |||
214 | /** |
||
215 | * Delegate a backup container to be checked for services if it |
||
216 | * cannot be resolved via this container. |
||
217 | * |
||
218 | * @param \Interop\Container\ContainerInterface $container |
||
219 | * @return $this |
||
220 | */ |
||
221 | 9 | public function delegate(InteropContainerInterface $container) |
|
231 | |||
232 | /** |
||
233 | * Returns true if service is registered in one of the delegated backup containers. |
||
234 | * |
||
235 | * @param string $alias |
||
236 | * @return boolean |
||
237 | */ |
||
238 | 9 | public function hasInDelegate($alias) |
|
248 | |||
249 | /** |
||
250 | * Attempt to get a service from the stack of delegated backup containers. |
||
251 | * |
||
252 | * @param string $alias |
||
253 | * @param array $args |
||
254 | * @return mixed |
||
255 | */ |
||
256 | 9 | protected function getFromDelegate($alias, array $args = []) |
|
268 | |||
269 | /** |
||
270 | * Get a service that has been registered in this container. |
||
271 | * |
||
272 | * @return mixed Entry|false. |
||
273 | */ |
||
274 | 24 | protected function getFromThisContainer($alias, array $args = []) |
|
294 | } |
||
295 |