1 | <?php |
||
9 | class Container implements ContainerInterface |
||
10 | { |
||
11 | private static $instance; |
||
12 | |||
13 | /** |
||
14 | * Resolved types |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $definitions = []; |
||
18 | |||
19 | /** |
||
20 | * Globally available container |
||
21 | * |
||
22 | * @return static |
||
23 | */ |
||
24 | public static function getInstance() |
||
32 | |||
33 | /** |
||
34 | * Add item to the container |
||
35 | * @param string $id |
||
36 | * @param mixed|null $concrete |
||
37 | */ |
||
38 | public function add($id, $concrete = null) |
||
54 | |||
55 | /** |
||
56 | * Check if item is available in container |
||
57 | * @param string $id |
||
58 | * @return boolean |
||
59 | */ |
||
60 | public function has($id) |
||
72 | |||
73 | /** |
||
74 | * Get an item of the container |
||
75 | * @param string $id |
||
76 | * @return mixed |
||
77 | * @throw NotFoundException |
||
78 | */ |
||
79 | public function get($id) |
||
91 | |||
92 | /** |
||
93 | * Call method with given parameters |
||
94 | * @param string|array|callable $action |
||
95 | * @param array $args |
||
96 | * @return mixed |
||
97 | */ |
||
98 | public function call ($action, array $args = []) |
||
132 | |||
133 | /** |
||
134 | * Get reflection from an action |
||
135 | * @param string $method |
||
136 | * @param string|null $class |
||
137 | * @return callable |
||
138 | */ |
||
139 | public function getActionReflection($method, $class = null) |
||
147 | |||
148 | /** |
||
149 | * Find object and set classname alias on argument list |
||
150 | * @param array $args |
||
151 | * @return array |
||
152 | */ |
||
153 | public function getParametersDictionary(array $args = []) |
||
164 | |||
165 | /** |
||
166 | * Get reflection parameters |
||
167 | * @param \ReflectionFunctionAbstract $reflection |
||
168 | * @param array $args |
||
169 | * @return array |
||
170 | */ |
||
171 | public function getParameters(\ReflectionFunctionAbstract $reflection, array $args = []) |
||
182 | |||
183 | /** |
||
184 | * Get paremeter value |
||
185 | * @param \ReflectionParameter $parameter |
||
186 | * @param array $args |
||
187 | * @return mixed |
||
188 | */ |
||
189 | public function getParameter(\ReflectionParameter $parameter, array $args = []) |
||
207 | |||
208 | /** |
||
209 | * Create a new container for asked class |
||
210 | * @param string $class |
||
211 | * @return Container |
||
212 | */ |
||
213 | public function build ($class) |
||
224 | } |
||
225 |