Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
29 | 4 | public function getHandlerForCommand($commandName) |
|
30 | { |
||
31 | 4 | if (!$this->commandExists($commandName)) { |
|
32 | 1 | throw MissingHandlerException::forCommand($commandName); |
|
33 | } |
||
34 | |||
35 | 3 | $serviceNameOrFQCN = $this->handlerMap[$commandName]; |
|
36 | |||
37 | 3 | if ($this->container->has($serviceNameOrFQCN)) { |
|
38 | 1 | return $this->container->get($serviceNameOrFQCN); |
|
39 | } |
||
40 | |||
41 | 2 | if (class_exists($serviceNameOrFQCN)) { |
|
42 | 1 | return new $serviceNameOrFQCN(); |
|
43 | } |
||
44 | |||
45 | 1 | throw MissingHandlerException::forCommand($commandName); |
|
46 | } |
||
47 | |||
61 |