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 | */ |
||
51 | public function __construct(array $config = array()) |
||
57 | |||
58 | /** |
||
59 | * Loads de default config file. |
||
60 | * |
||
61 | * @param array $config |
||
62 | * |
||
63 | * @throws DuplicatedServiceNameException |
||
64 | */ |
||
65 | private function registerFromConfig(array $config) |
||
72 | |||
73 | /** |
||
74 | * Register a Service. |
||
75 | * |
||
76 | * @param string $serviceName |
||
77 | * @param array $regex |
||
78 | * @param string|callable $factory |
||
79 | * |
||
80 | * @throws DuplicatedServiceNameException |
||
81 | */ |
||
82 | public function registerService($serviceName, array $regex, $factory) |
||
92 | |||
93 | /** |
||
94 | * @param string $rendererName |
||
95 | * @param string $rendererFactory |
||
96 | */ |
||
97 | public function setRenderer($rendererName, $rendererFactory) |
||
103 | |||
104 | /** |
||
105 | * @return EmbedRendererInterface |
||
106 | */ |
||
107 | public function getRenderer() |
||
111 | |||
112 | /** |
||
113 | * @return array |
||
114 | */ |
||
115 | public function getServiceNameList() |
||
119 | |||
120 | /** |
||
121 | * @param string $serviceName |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | public function hasService($serviceName) |
||
129 | |||
130 | /** |
||
131 | * @return array |
||
132 | */ |
||
133 | public function getServices() |
||
137 | |||
138 | /** |
||
139 | * @return array |
||
140 | */ |
||
141 | public function getPatterns() |
||
145 | |||
146 | /** |
||
147 | * @param string $serviceName |
||
148 | * |
||
149 | * @return CallableServiceAdapterFactoryInterface |
||
150 | */ |
||
151 | public function getFactory($serviceName) |
||
160 | } |
||
161 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.