Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function validate(mixed $value, object $rule, ValidationContext $context): Result |
||
19 | { |
||
20 | if (!$rule instanceof StopOnError) { |
||
21 | throw new UnexpectedRuleException(StopOnError::class, $rule); |
||
22 | } |
||
23 | |||
24 | foreach ($rule->getRules() as $relatedRule) { |
||
25 | $result = $context->validate($value, $relatedRule); |
||
26 | if (!$result->isValid()) { |
||
27 | return $result; |
||
28 | } |
||
29 | } |
||
30 | |||
31 | return new Result(); |
||
32 | } |
||
34 |