| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | private function commandToHandler(string $command): CommandHandlerInterface |
||
| 44 | { |
||
| 45 | $commandHandler = explode('\\', $command); |
||
| 46 | $commandHandler[count($commandHandler) - 1] = str_replace('Command', 'Handler', $commandHandler[count($commandHandler) - 1]); |
||
| 47 | $commandHandler = implode('\\', $commandHandler); |
||
| 48 | $handler = $this->handlers[$commandHandler]; |
||
| 49 | |||
| 50 | if (!$handler instanceof CommandHandlerInterface) { |
||
| 51 | throw new HandlerNotFoundException('Handler not found from: '.$command); |
||
| 52 | } |
||
| 53 | |||
| 54 | return $handler; |
||
| 55 | } |
||
| 57 |