| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 27 | public function getHandlerForCommand($commandName) |
||
| 28 | 3 | { |
|
| 29 | 2 | $handlerFQCN = $commandName . 'Handler'; |
|
| 30 | |||
| 31 | try { |
||
| 32 | return $this->serviceLocator->get($handlerFQCN); |
||
| 33 | } catch (ServiceNotFoundException $e) { |
||
| 34 | 2 | // Further check exists for class availability. |
|
| 35 | 1 | // If not, Exception will be thrown anyway. |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | if (class_exists($handlerFQCN)) { |
|
| 39 | return new $handlerFQCN(); |
||
| 40 | } |
||
| 41 | |||
| 42 | throw MissingHandlerException::forCommand($commandName); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |