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