| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 3 | public function execute(Command $command): void |
|
| 22 | { |
||
| 23 | 3 | $commandClass = \get_class($command); |
|
| 24 | |||
| 25 | 3 | if (false === isset($this->handlers[$commandClass])) { |
|
| 26 | 1 | throw CommandHandlerNotFound::forCommand($commandClass); |
|
| 27 | } |
||
| 28 | |||
| 29 | 2 | if (false === is_callable($this->handlers[$commandClass])) { |
|
| 30 | 1 | throw new CommandHandlerIsNotCallable(); |
|
| 31 | } |
||
| 32 | |||
| 33 | 1 | ($this->handlers[$commandClass])($command); |
|
| 34 | 1 | } |
|
| 35 | } |
||
| 36 |