Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
57 | public function create($service) |
||
58 | { |
||
59 | if(!isset($this->services[$service])) { |
||
60 | throw new NotFoundException('Service not found: ' . $service); |
||
61 | } |
||
62 | |||
63 | if (!class_exists($this->services[$service]->class)) { |
||
64 | throw new ContainerException( |
||
65 | 'Class does not exists: ' . $this->services[$service]->class |
||
66 | ); |
||
67 | } |
||
68 | |||
69 | $service = new \ReflectionClass($this->services[$service]->class); |
||
70 | return $service->newInstance(); |
||
71 | } |
||
72 | } |
||
73 |