Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
18 | 6 | public function validate(mixed $value, object $rule, ValidatorInterface $validator, ?ValidationContext $context = null): Result |
|
19 | { |
||
20 | 6 | if (!$rule instanceof GroupRule) { |
|
21 | 1 | throw new UnexpectedRuleException(GroupRule::class, $rule); |
|
22 | } |
||
23 | |||
24 | 5 | $result = new Result(); |
|
25 | 5 | if (!$validator->validate($value, $rule->getRuleSet())->isValid()) { |
|
26 | 4 | $result->addError($rule->message); |
|
27 | } |
||
28 | |||
29 | 5 | return $result; |
|
30 | } |
||
32 |