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