| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 1 | public function validateCommand(Command $command) |
|
| 36 | { |
||
| 37 | 1 | $handlerDescriptors = $this->commandValidatorSubscriber->getHandlersForCommand($command); |
|
| 38 | |||
| 39 | 1 | $errors = []; |
|
| 40 | |||
| 41 | /** @var CommandHandlerDescriptor $handlerDescriptor */ |
||
| 42 | 1 | foreach ($handlerDescriptors as $handlerDescriptor) { |
|
| 43 | 1 | $handler = $this->abstractFactory->createObject($handlerDescriptor->getHandlerClass()); |
|
| 44 | |||
| 45 | 1 | $generator = call_user_func([$handler, $handlerDescriptor->getMethodName()], $command); |
|
| 46 | |||
| 47 | 1 | $ownErrors = iterator_to_array($generator, false); |
|
| 48 | |||
| 49 | 1 | $errors = array_merge($errors, $ownErrors); |
|
| 50 | } |
||
| 51 | |||
| 52 | 1 | return $errors; |
|
| 53 | } |
||
| 54 | } |