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 | * |
||
129 | * @return bool |
||
130 | */ |
||
131 | 2 | public function isBound($name) |
|
135 | |||
136 | /** |
||
137 | * @param $concrete |
||
138 | * @param ReflectionParameter[] $reflectionParameters |
||
139 | * |
||
140 | * @throws Exception |
||
141 | * |
||
142 | * @return array |
||
143 | */ |
||
144 | 5 | protected function getDependencies($concrete, array $reflectionParameters) |
|
178 | |||
179 | /** |
||
180 | * @param $implementation |
||
181 | * |
||
182 | * @throws ReflectionException |
||
183 | * |
||
184 | * @return mixed|object |
||
185 | */ |
||
186 | 2 | protected function buildContextualBinding($implementation) |
|
194 | |||
195 | /** |
||
196 | * @param $name |
||
197 | * |
||
198 | * @return string|Closure |
||
199 | */ |
||
200 | 13 | protected function getConcrete($name) |
|
212 | |||
213 | /** |
||
214 | * @param mixed $offset |
||
215 | * |
||
216 | * @return bool |
||
217 | */ |
||
218 | 2 | public function offsetExists($offset) |
|
222 | |||
223 | /** |
||
224 | * @param mixed $offset |
||
225 | * |
||
226 | * @throws ReflectionException |
||
227 | * |
||
228 | * @return mixed|object |
||
229 | */ |
||
230 | 1 | public function offsetGet($offset) |
|
234 | |||
235 | /** |
||
236 | * @param mixed $offset |
||
237 | * @param mixed $value |
||
238 | */ |
||
239 | 2 | public function offsetSet($offset, $value) |
|
243 | |||
244 | /** |
||
245 | * @param mixed $offset |
||
246 | */ |
||
247 | 1 | public function offsetUnset($offset) |
|
251 | } |
||
252 |