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 | protected $contextual = []; |
||
36 | |||
37 | /** |
||
38 | * @param $name |
||
39 | * @param null $concrete |
||
40 | * @param bool $share |
||
41 | */ |
||
42 | 10 | public function bind($name, $concrete = null, $share = false) |
|
52 | |||
53 | /** |
||
54 | * @param $concretes |
||
55 | * @param $parameter |
||
56 | * @param $implementation |
||
57 | */ |
||
58 | 2 | public function bindContext($concretes, $parameter, $implementation) |
|
64 | |||
65 | /** |
||
66 | * @param $name |
||
67 | * @param $instance |
||
68 | */ |
||
69 | 1 | public function instance($name, $instance) |
|
73 | |||
74 | /** |
||
75 | * @param string $name |
||
76 | * |
||
77 | * @throws ReflectionException |
||
78 | * |
||
79 | * @return object |
||
80 | */ |
||
81 | 15 | public function make($name) |
|
95 | |||
96 | /** |
||
97 | * @param $name |
||
98 | * |
||
99 | * @throws ReflectionException |
||
100 | * |
||
101 | * @return mixed|object |
||
102 | */ |
||
103 | 13 | protected function build($name) |
|
125 | |||
126 | /** |
||
127 | * @param $name |
||
128 | * @return bool |
||
129 | */ |
||
130 | 2 | public function isBound($name) |
|
134 | |||
135 | /** |
||
136 | * @param $concrete |
||
137 | * @param ReflectionParameter[] $reflectionParameters |
||
138 | * @return array |
||
139 | * @throws Exception |
||
140 | */ |
||
141 | 5 | protected function getDependencies($concrete, array $reflectionParameters) |
|
175 | |||
176 | /** |
||
177 | * @param $implementation |
||
178 | * @return mixed|object |
||
179 | * @throws ReflectionException |
||
180 | */ |
||
181 | 2 | protected function buildContextualBinding($implementation) |
|
188 | |||
189 | /** |
||
190 | * @param $name |
||
191 | * |
||
192 | * @return string|Closure |
||
193 | */ |
||
194 | 13 | protected function getConcrete($name) |
|
206 | |||
207 | /** |
||
208 | * @param mixed $offset |
||
209 | * |
||
210 | * @return bool |
||
211 | */ |
||
212 | 2 | public function offsetExists($offset) |
|
216 | |||
217 | /** |
||
218 | * @param mixed $offset |
||
219 | * |
||
220 | * @throws ReflectionException |
||
221 | * |
||
222 | * @return mixed|object |
||
223 | */ |
||
224 | 1 | public function offsetGet($offset) |
|
228 | |||
229 | /** |
||
230 | * @param mixed $offset |
||
231 | * @param mixed $value |
||
232 | */ |
||
233 | 2 | public function offsetSet($offset, $value) |
|
237 | |||
238 | /** |
||
239 | * @param mixed $offset |
||
240 | */ |
||
241 | 1 | public function offsetUnset($offset) |
|
245 | } |
||
246 |