1 | <?php |
||
20 | class Container implements ArrayAccess, ContainerInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $bindings = []; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $instances = []; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $shares = []; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $contextual = []; |
||
41 | |||
42 | /** |
||
43 | * @param string $name |
||
44 | * @param string|callable $concrete |
||
45 | * @param bool $share |
||
46 | */ |
||
47 | 12 | public function bind($name, $concrete = null, $share = false) |
|
57 | |||
58 | /** |
||
59 | * @param $concretes |
||
60 | * @param $parameter |
||
61 | * @param $implementation |
||
62 | */ |
||
63 | 2 | public function bindContext($concretes, $parameter, $implementation) |
|
69 | |||
70 | /** |
||
71 | * @param $name |
||
72 | * @param $instance |
||
73 | */ |
||
74 | 2 | public function instance($name, $instance) |
|
78 | |||
79 | /** |
||
80 | * @param string $name |
||
81 | * |
||
82 | * @throws ReflectionException |
||
83 | * |
||
84 | * @return object |
||
85 | */ |
||
86 | 16 | public function make($name) |
|
100 | |||
101 | /** |
||
102 | * @param $name |
||
103 | * |
||
104 | * @throws ReflectionException |
||
105 | * @throws BindingResolutionException |
||
106 | * |
||
107 | * @return mixed|object |
||
108 | */ |
||
109 | 14 | protected function build($name) |
|
131 | |||
132 | /** |
||
133 | * @param $name |
||
134 | * |
||
135 | * @return bool |
||
136 | */ |
||
137 | 4 | public function isBound($name) |
|
141 | |||
142 | /** |
||
143 | * @param $concrete |
||
144 | * @param ReflectionParameter[] $reflectionParameters |
||
145 | * |
||
146 | * @throws Exception |
||
147 | * |
||
148 | * @return array |
||
149 | */ |
||
150 | 5 | protected function getDependencies($concrete, array $reflectionParameters) |
|
190 | |||
191 | /** |
||
192 | * @param $implementation |
||
193 | * |
||
194 | * @throws ReflectionException |
||
195 | * |
||
196 | * @return mixed|object |
||
197 | */ |
||
198 | 2 | protected function buildContextualBinding($implementation) |
|
210 | |||
211 | /** |
||
212 | * @param $name |
||
213 | * |
||
214 | * @return string|Closure |
||
215 | */ |
||
216 | 14 | protected function getConcrete($name) |
|
228 | |||
229 | /** |
||
230 | * @param mixed $offset |
||
231 | * |
||
232 | * @return bool |
||
233 | */ |
||
234 | 2 | public function offsetExists($offset) |
|
238 | |||
239 | /** |
||
240 | * @param mixed $offset |
||
241 | * |
||
242 | * @throws ReflectionException |
||
243 | * |
||
244 | * @return mixed|object |
||
245 | */ |
||
246 | 1 | public function offsetGet($offset) |
|
250 | |||
251 | /** |
||
252 | * @param mixed $offset |
||
253 | * @param mixed $value |
||
254 | */ |
||
255 | 2 | public function offsetSet($offset, $value) |
|
259 | |||
260 | /** |
||
261 | * @param mixed $offset |
||
262 | */ |
||
263 | 1 | public function offsetUnset($offset) |
|
267 | |||
268 | /** |
||
269 | * {@inheritdoc} |
||
270 | */ |
||
271 | 1 | public function get($id) |
|
279 | |||
280 | /** |
||
281 | * {@inheritdoc} |
||
282 | */ |
||
283 | 1 | public function has($id) |
|
287 | } |
||
288 |