Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | protected function guardResult( |
||
28 | Result $result, |
||
29 | ValidationExceptionInterface | string | null $validationException = null |
||
30 | ): void { |
||
31 | if ($result->isOk()) { |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | $exception = $this->createValidationException($validationException); |
||
36 | foreach ($result->getErrors() as $error) { |
||
37 | $exception->addError($error->message(), $error->field()); |
||
38 | } |
||
39 | |||
40 | throw $exception; |
||
41 | } |
||
52 |