1 | <?php |
||
8 | class Container implements ContainerInterface |
||
9 | { |
||
10 | /** @var \Closure[] */ |
||
11 | private $serviceFactories = []; |
||
12 | |||
13 | /** @var array */ |
||
14 | private $services = []; |
||
15 | |||
16 | /** @var ContainerInterface */ |
||
17 | private $delegateContainer; |
||
18 | |||
19 | /** |
||
20 | * @param string $serviceId |
||
21 | * @param \Closure $serviceFactory |
||
22 | */ |
||
23 | public function set($serviceId, \Closure $serviceFactory) |
||
24 | { |
||
25 | $this->serviceFactories[$serviceId] = $serviceFactory; |
||
26 | unset($this->services[$serviceId]); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param string $path |
||
31 | */ |
||
32 | public function configureFromFile(string $path) |
||
38 | |||
39 | /** |
||
40 | * @throws NotFoundException |
||
41 | * |
||
42 | * @param string $serviceId |
||
43 | * @return mixed |
||
44 | */ |
||
45 | public function get($serviceId) |
||
57 | |||
58 | /** |
||
59 | * @return string[] |
||
60 | */ |
||
61 | public function listServiceIds() : array |
||
65 | |||
66 | /** |
||
67 | * @return mixed |
||
68 | */ |
||
69 | private function getServiceFromFactory(string $serviceId) |
||
75 | |||
76 | /** |
||
77 | * @param string $serviceId |
||
78 | * @return bool |
||
79 | */ |
||
80 | public function has($serviceId) |
||
84 | |||
85 | public function setDelegateContainer(ContainerInterface $delegateContainer) |
||
89 | } |
||
90 |