| Conditions | 4 |
| Paths | 6 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 5 | public function validate(mixed $value, object $rule, ValidatorInterface $validator, ?ValidationContext $context = null): Result |
|
| 21 | { |
||
| 22 | 5 | $filledCount = 0; |
|
| 23 | |||
| 24 | 5 | foreach ($rule->attributes as $attribute) { |
|
| 25 | 5 | if (!$this->isEmpty($value->{$attribute})) { |
|
| 26 | 4 | $filledCount++; |
|
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | 5 | $result = new Result(); |
|
| 31 | |||
| 32 | 5 | if ($filledCount < $rule->min) { |
|
| 33 | 3 | $result->addError($rule->message, ['min' => $rule->min]); |
|
| 34 | } |
||
| 35 | |||
| 36 | 5 | return $result; |
|
| 37 | } |
||
| 39 |