Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
21 | 2 | public function getHandlerForCommand(Command $command) |
|
22 | { |
||
23 | 2 | $definitions = $this->getCommandHandlersDefinitions(); |
|
24 | |||
25 | 2 | if (isset($definitions[get_class($command)])) { |
|
26 | 1 | $handlersForCommand = $definitions[get_class($command)]; |
|
27 | |||
28 | 1 | if ($handlersForCommand) { |
|
29 | 1 | foreach ($handlersForCommand as $commandDefinition) { |
|
30 | |||
31 | 1 | list($aggregateClass, $methodName) = $commandDefinition; |
|
32 | |||
33 | 1 | return new CommandHandlerDescriptor($aggregateClass, $methodName); |
|
34 | } |
||
35 | } |
||
36 | } |
||
37 | |||
38 | 1 | throw new CommandHandlerNotFound(sprintf("A handler for command %s was not found", get_class($command))); |
|
39 | } |
||
40 | |||
42 | } |