| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 23 | public function execute($command, callable $next) |
||
| 24 | { |
||
| 25 | if (!$command->validate()) { |
||
| 26 | // TODO: enhance handling of multiple errors in the same command. |
||
| 27 | $errors = $command->getFirstErrors(); |
||
| 28 | |||
| 29 | throw new ValidationException(sprintf( |
||
| 30 | '%s: %s', |
||
| 31 | array_key_first($errors), |
||
| 32 | reset($errors) |
||
| 33 | )); |
||
| 34 | } |
||
| 35 | |||
| 36 | return $next($command); |
||
| 37 | } |
||
| 38 | } |
||
| 39 |