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