Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function get($id) |
||
15 | { |
||
16 | if (!array_key_exists($id, $this->container_stack)) { |
||
17 | throw new NotFoundException(); |
||
18 | } |
||
19 | |||
20 | if (is_callable($this->container_stack[$id])) { |
||
21 | try { |
||
22 | // entry: service or value |
||
23 | $entry = call_user_func($this->container_stack[$id], $this); |
||
24 | } catch (NotFoundException $e) { |
||
25 | throw $e; |
||
26 | } catch (\Exception $e) { |
||
27 | throw new ContainerException($e->getMessage()); |
||
28 | } |
||
29 | return $entry; |
||
30 | } |
||
31 | |||
32 | return $this->container_stack[$id]; |
||
33 | } |
||
34 | |||
40 |