Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
46 | public function offsetGet($offset) |
||
47 | { |
||
48 | // Service has already been inited, returning it |
||
49 | if (isset($this->content[$offset])) { |
||
50 | return $this->content[$offset]; |
||
51 | } |
||
52 | |||
53 | // Instantiate a new copy from warehouse if available |
||
54 | if (isset($this->warehouse[$offset])) { |
||
55 | $this->content[$offset] = new $this->warehouse[$offset](); |
||
56 | return $this->content[$offset]; |
||
57 | } |
||
58 | |||
59 | throw new InvalidArgumentException('Unknown service ' . $offset); |
||
60 | } |
||
62 |