1 | <?php |
||
18 | class Container implements ArrayAccess |
||
19 | { |
||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $bindings = []; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $instances = []; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $shares = []; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $contextual = []; |
||
39 | |||
40 | /** |
||
41 | * @param string $name |
||
42 | * @param string|callable $concrete |
||
43 | * @param bool $share |
||
44 | */ |
||
45 | 10 | public function bind($name, $concrete = null, $share = false) |
|
55 | |||
56 | /** |
||
57 | * @param $concretes |
||
58 | * @param $parameter |
||
59 | * @param $implementation |
||
60 | */ |
||
61 | 2 | public function bindContext($concretes, $parameter, $implementation) |
|
67 | |||
68 | /** |
||
69 | * @param $name |
||
70 | * @param $instance |
||
71 | */ |
||
72 | 1 | public function instance($name, $instance) |
|
76 | |||
77 | /** |
||
78 | * @param string $name |
||
79 | * |
||
80 | * @throws ReflectionException |
||
81 | * |
||
82 | * @return object |
||
83 | */ |
||
84 | 15 | public function make($name) |
|
98 | |||
99 | /** |
||
100 | * @param $name |
||
101 | * |
||
102 | * @throws ReflectionException |
||
103 | * |
||
104 | * @return mixed|object |
||
105 | */ |
||
106 | 13 | protected function build($name) |
|
128 | |||
129 | /** |
||
130 | * @param $name |
||
131 | * |
||
132 | * @return bool |
||
133 | */ |
||
134 | 2 | public function isBound($name) |
|
138 | |||
139 | /** |
||
140 | * @param $concrete |
||
141 | * @param ReflectionParameter[] $reflectionParameters |
||
142 | * |
||
143 | * @throws Exception |
||
144 | * |
||
145 | * @return array |
||
146 | */ |
||
147 | 5 | protected function getDependencies($concrete, array $reflectionParameters) |
|
187 | |||
188 | /** |
||
189 | * @param $implementation |
||
190 | * |
||
191 | * @throws ReflectionException |
||
192 | * |
||
193 | * @return mixed|object |
||
194 | */ |
||
195 | 2 | protected function buildContextualBinding($implementation) |
|
207 | |||
208 | /** |
||
209 | * @param $name |
||
210 | * |
||
211 | * @return string|Closure |
||
212 | */ |
||
213 | 13 | protected function getConcrete($name) |
|
225 | |||
226 | /** |
||
227 | * @param mixed $offset |
||
228 | * |
||
229 | * @return bool |
||
230 | */ |
||
231 | 2 | public function offsetExists($offset) |
|
235 | |||
236 | /** |
||
237 | * @param mixed $offset |
||
238 | * |
||
239 | * @throws ReflectionException |
||
240 | * |
||
241 | * @return mixed|object |
||
242 | */ |
||
243 | 1 | public function offsetGet($offset) |
|
247 | |||
248 | /** |
||
249 | * @param mixed $offset |
||
250 | * @param mixed $value |
||
251 | */ |
||
252 | 2 | public function offsetSet($offset, $value) |
|
256 | |||
257 | /** |
||
258 | * @param mixed $offset |
||
259 | */ |
||
260 | 1 | public function offsetUnset($offset) |
|
264 | } |
||
265 |