Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
26 | 3 | public function getHandlerForCommand($commandName) |
|
27 | { |
||
28 | 3 | $handlerFQCN = $commandName . 'Handler'; |
|
29 | |||
30 | 3 | if ($this->container->has($handlerFQCN)) { |
|
31 | 1 | return $this->container->get($handlerFQCN); |
|
32 | } |
||
33 | |||
34 | 2 | if (class_exists($handlerFQCN)) { |
|
35 | 1 | return new $handlerFQCN(); |
|
36 | } |
||
37 | |||
38 | 1 | throw MissingHandlerException::forCommand($commandName); |
|
39 | } |
||
40 | } |
||
41 |