1 | <?php |
||
22 | class Container implements ContainerInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $services = array(); |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $aliases = array(); |
||
33 | |||
34 | /** |
||
35 | * @var ParameterBagInterface |
||
36 | */ |
||
37 | protected $parameter; |
||
38 | |||
39 | /** |
||
40 | * @var Di |
||
41 | */ |
||
42 | protected $di; |
||
43 | |||
44 | /** |
||
45 | * Constructor. |
||
46 | * |
||
47 | * @param ParameterBagInterface $parameterBag |
||
48 | * @param Di $di |
||
49 | */ |
||
50 | public function __construct(ParameterBagInterface $parameterBag = null, Di $di = null) |
||
55 | |||
56 | /** |
||
57 | * Compile parameter. |
||
58 | * |
||
59 | * Parameter become immutable. |
||
60 | * |
||
61 | * @return static |
||
62 | */ |
||
63 | public function compile() |
||
71 | |||
72 | /** |
||
73 | * Check if container is immutable. |
||
74 | * |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function isImmutable() |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | public function set($id, $service) |
||
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | public function share($id, $service, array $args = array()) |
||
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | public function get($id, array $args = array(), $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) |
||
133 | |||
134 | /** |
||
135 | * Check if service id has alias. |
||
136 | * |
||
137 | * @param string $id |
||
138 | * |
||
139 | * @return bool |
||
140 | */ |
||
141 | public function hasAlias($id) |
||
151 | |||
152 | /** |
||
153 | * Get id from alias. |
||
154 | * |
||
155 | * @param string $id |
||
156 | * |
||
157 | * @return string|null |
||
158 | */ |
||
159 | public function getAliasFromId($id) |
||
169 | |||
170 | /** |
||
171 | * {@inheritdoc} |
||
172 | */ |
||
173 | public function has($id) |
||
177 | |||
178 | /** |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | public function getParameterBag() |
||
185 | |||
186 | /** |
||
187 | * Get instance builder. |
||
188 | * |
||
189 | * @return Di |
||
190 | */ |
||
191 | public function getDi() |
||
195 | |||
196 | /** |
||
197 | * Execute service. |
||
198 | * |
||
199 | * @param mixed $service |
||
200 | * @param array $args |
||
201 | * |
||
202 | * @return mixed |
||
203 | */ |
||
204 | protected function callService($service, array $args = array()) |
||
212 | |||
213 | /** |
||
214 | * Get service id. |
||
215 | * |
||
216 | * @param string $id |
||
217 | * |
||
218 | * @return string |
||
219 | */ |
||
220 | protected function getServiceId($id) |
||
228 | } |
||
229 |