1 | <?php |
||
14 | class ServicesContainer |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | private $services = array(); |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $patterns = array(); |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private $factories = array(); |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private $instantiatedFactories = array(); |
||
35 | |||
36 | /** |
||
37 | * @var EmbedRendererInterface |
||
38 | */ |
||
39 | private $renderer; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | private $rendererName; |
||
45 | |||
46 | /** |
||
47 | * ServicesContainer constructor. |
||
48 | * |
||
49 | * @param array $config |
||
50 | * @throws DuplicatedServiceNameException |
||
51 | */ |
||
52 | public function __construct(array $config = array()) |
||
58 | |||
59 | /** |
||
60 | * Loads de default config file. |
||
61 | * |
||
62 | * @param array $config |
||
63 | * |
||
64 | * @throws DuplicatedServiceNameException |
||
65 | */ |
||
66 | private function registerFromConfig(array $config) |
||
73 | |||
74 | /** |
||
75 | * Register a Service. |
||
76 | * |
||
77 | * @param string $serviceName |
||
78 | * @param array $regex |
||
79 | * @param string|callable $factory |
||
80 | * |
||
81 | * @throws DuplicatedServiceNameException |
||
82 | */ |
||
83 | public function registerService($serviceName, array $regex, $factory) |
||
95 | |||
96 | /** |
||
97 | * @param string $rendererName |
||
98 | * @param string $rendererFactory |
||
99 | */ |
||
100 | public function setRenderer($rendererName, $rendererFactory) |
||
106 | |||
107 | /** |
||
108 | * @return EmbedRendererInterface |
||
109 | */ |
||
110 | public function getRenderer() |
||
114 | |||
115 | /** |
||
116 | * @return array |
||
117 | */ |
||
118 | public function getServiceNameList() |
||
122 | |||
123 | /** |
||
124 | * @param string $serviceName |
||
125 | * |
||
126 | * @return bool |
||
127 | */ |
||
128 | public function hasService($serviceName) |
||
132 | |||
133 | /** |
||
134 | * @return array |
||
135 | */ |
||
136 | public function getServices() |
||
140 | |||
141 | /** |
||
142 | * @return array |
||
143 | */ |
||
144 | public function getPatterns() |
||
148 | |||
149 | /** |
||
150 | * @param string $serviceName |
||
151 | * |
||
152 | * @return CallableServiceAdapterFactoryInterface |
||
153 | */ |
||
154 | public function getFactory($serviceName) |
||
163 | } |
||
164 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.