| Conditions | 5 |
| Paths | 7 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | protected function execute($value): ValidationResultInterface |
||
| 17 | { |
||
| 18 | $result = parent::execute($value); |
||
| 19 | if ($result->preventNextChecks()) { |
||
| 20 | return $result; |
||
| 21 | } |
||
| 22 | |||
| 23 | $result = new ValidationSuccessResult(false); |
||
| 24 | |||
| 25 | $errors = []; |
||
| 26 | foreach ($this->rules as $rule) { |
||
| 27 | try { |
||
| 28 | $rule->validate($value); |
||
| 29 | } catch (ValidationError $e) { |
||
| 30 | $errors[] = $e; |
||
| 31 | break; |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | if (\count($errors) === 0) { |
||
| 36 | return $result; |
||
| 37 | } |
||
| 38 | |||
| 39 | throw ValidationError::fromValidationErrors($value, $errors); |
||
| 40 | } |
||
| 42 |