1 | <?php |
||
34 | class Container implements ContainerInterface |
||
35 | { |
||
36 | /** |
||
37 | * @var ArrayObject |
||
38 | */ |
||
39 | private $definitions; |
||
40 | |||
41 | /** |
||
42 | * @var ArrayObject |
||
43 | */ |
||
44 | private $entries; |
||
45 | |||
46 | /** |
||
47 | * @var ArrayObject |
||
48 | */ |
||
49 | private $resolving; |
||
50 | |||
51 | /** |
||
52 | * @var bool |
||
53 | */ |
||
54 | private $useAutowiring; |
||
55 | |||
56 | /** |
||
57 | * @var bool |
||
58 | */ |
||
59 | private $useAnnotations; |
||
60 | |||
61 | /** |
||
62 | * @var ResolverFactoryInterface |
||
63 | */ |
||
64 | private $resolverFactory; |
||
65 | |||
66 | /** |
||
67 | * @var DefinitionFactoryInterface |
||
68 | */ |
||
69 | private $definitionFactory; |
||
70 | |||
71 | /** |
||
72 | * @param DefinitionFactoryInterface $definitionFactory |
||
73 | * @param ResolverFactoryInterface $resolverFactory |
||
74 | */ |
||
75 | 21 | public function __construct(DefinitionFactoryInterface $definitionFactory, ResolverFactoryInterface $resolverFactory) |
|
84 | |||
85 | /** |
||
86 | * @inheritDoc |
||
87 | */ |
||
88 | 20 | public function get($id) |
|
104 | |||
105 | /** |
||
106 | * Creates new entry by its identifier and returns it. |
||
107 | * |
||
108 | * @param string $id Identifier of the entry to look for. |
||
109 | * |
||
110 | * @throws NotFoundExceptionInterface No entry was found for **this** identifier. |
||
111 | * @throws ContainerExceptionInterface Error while creating the entry. |
||
112 | * |
||
113 | * @return mixed Entry. |
||
114 | */ |
||
115 | 1 | public function make(string $id) |
|
119 | |||
120 | /** |
||
121 | * @inheritDoc |
||
122 | */ |
||
123 | 3 | public function has($id): bool |
|
135 | |||
136 | /** |
||
137 | * @param string $id |
||
138 | * |
||
139 | * @throws CircularDependencyFoundException |
||
140 | * @throws ClassNotFoundException |
||
141 | * @throws ContainerException |
||
142 | * @throws DefinitionNotFoundException |
||
143 | * @throws InvalidDefinitionException |
||
144 | * |
||
145 | * @return mixed |
||
146 | */ |
||
147 | 19 | private function resolveEntry(string $id) |
|
157 | |||
158 | /** |
||
159 | * @param bool $useAutowiring |
||
160 | */ |
||
161 | 21 | public function useAutowiring(bool $useAutowiring): void |
|
165 | |||
166 | /** |
||
167 | * @return bool |
||
168 | */ |
||
169 | 13 | private function hasAutowiringEnabled(): bool |
|
173 | |||
174 | /** |
||
175 | * @param bool $useAnnotations |
||
176 | */ |
||
177 | 21 | public function useAnnotations(bool $useAnnotations): void |
|
181 | |||
182 | /** |
||
183 | * @return bool |
||
184 | */ |
||
185 | 10 | public function hasAnnotationsEnabled(): bool |
|
189 | |||
190 | /** |
||
191 | * @param ArrayObject $definitions |
||
192 | */ |
||
193 | 21 | public function setDefinitions(ArrayObject $definitions): void |
|
197 | |||
198 | /** |
||
199 | * @param string $id |
||
200 | * |
||
201 | * @throws DefinitionNotFoundException |
||
202 | * @throws InvalidDefinitionException |
||
203 | * |
||
204 | * @return DefinitionInterface |
||
205 | */ |
||
206 | 19 | private function getDefinition(string $id): DefinitionInterface |
|
222 | |||
223 | /** |
||
224 | * @param string $id |
||
225 | * |
||
226 | * @throws CircularDependencyFoundException |
||
227 | * |
||
228 | * @return void |
||
229 | */ |
||
230 | 17 | private function startResolving(string $id): void |
|
238 | |||
239 | /** |
||
240 | * @param string $id |
||
241 | * |
||
242 | * @return void |
||
243 | */ |
||
244 | 11 | private function endResolving(string $id): void |
|
250 | } |
||
251 |