1 | <?php declare(strict_types=1); |
||
11 | class Container implements ContainerInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var \League\Container\Definition\DefinitionAggregateInterface |
||
15 | */ |
||
16 | protected $definitions; |
||
17 | |||
18 | /** |
||
19 | * @var \League\Container\ServiceProvider\ServiceProviderAggregateInterface |
||
20 | */ |
||
21 | protected $providers; |
||
22 | |||
23 | /** |
||
24 | * @var \League\Container\Inflector\InflectorAggregateInterface |
||
25 | */ |
||
26 | protected $inflectors; |
||
27 | |||
28 | /** |
||
29 | * @var \Psr\Container\ContainerInterface[] |
||
30 | */ |
||
31 | protected $delegates = []; |
||
32 | |||
33 | /** |
||
34 | * Construct. |
||
35 | * |
||
36 | * @param \League\Container\Definition\DefinitionAggregateInterface|null $definitions |
||
37 | * @param \League\Container\ServiceProvider\ServiceProviderAggregateInterface|null $providers |
||
38 | * @param \League\Container\Inflector\InflectorAggregateInterface|null $inflectors |
||
39 | */ |
||
40 | public function __construct( |
||
49 | |||
50 | /** |
||
51 | * Add an item to the container. |
||
52 | * |
||
53 | * @param string $id |
||
54 | * @param mixed $concrete |
||
55 | * @param boolean $shared |
||
56 | * |
||
57 | * @return \League\Container\Definition\DefinitionInterface |
||
58 | */ |
||
59 | public function add(string $id, $concrete = null, bool $shared = false): DefinitionInterface |
||
65 | |||
66 | 57 | /** |
|
67 | 56 | * Get a definition to extend. |
|
68 | 39 | * |
|
69 | * @param string $id [description] |
||
70 | 57 | * |
|
71 | 57 | * @return \League\Container\Definition\DefinitionInterface |
|
72 | 38 | */ |
|
73 | public function extend(string $id): DefinitionInterface |
||
87 | 21 | ||
88 | 12 | /** |
|
89 | * Add a service provider. |
||
90 | 12 | * |
|
91 | * @param \League\Container\ServiceProvider\ServiceProviderInterface|string $provider |
||
92 | * |
||
93 | 9 | * @return self |
|
94 | */ |
||
95 | 6 | public function addServiceProvider($provider): self |
|
101 | |||
102 | 21 | /** |
|
103 | * {@inheritdoc} |
||
104 | 21 | */ |
|
105 | 15 | public function get($id, array $args = [], bool $new = false) |
|
126 | 51 | ||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | public function has($id): bool |
||
148 | 33 | ||
149 | /** |
||
150 | * Allows for manipulation of specific types on resolution. |
||
151 | 39 | * |
|
152 | * @param string $type |
||
153 | * @param callable|null $callback |
||
154 | * |
||
155 | 6 | * @return \League\Container\Inflector\InflectorInterface |
|
156 | 6 | */ |
|
157 | public function inflector(string $type, callable $callback = null): InflectorInterface |
||
161 | 33 | ||
162 | /** |
||
163 | 33 | * Delegate a backup container to be checked for services if it |
|
164 | * cannot be resolved via this container. |
||
165 | * |
||
166 | * @param \Psr\Container\ContainerInterface $container |
||
167 | * |
||
168 | * @return self |
||
169 | 12 | */ |
|
170 | public function delegate(ContainerInterface $container): self |
||
180 | } |
||
181 |