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