Conditions | 4 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | 4 | protected function validateValue($value, ValidationContext $context = null): Result |
|
46 | { |
||
47 | 4 | $filledCount = 0; |
|
48 | |||
49 | 4 | foreach ($this->attributes as $attribute) { |
|
50 | 4 | if (!$this->isEmpty($value->{$attribute})) { |
|
51 | 3 | $filledCount++; |
|
52 | } |
||
53 | } |
||
54 | |||
55 | 4 | $result = new Result(); |
|
56 | |||
57 | 4 | if ($filledCount < $this->min) { |
|
58 | 2 | $result->addError( |
|
59 | 2 | $this->formatMessage( |
|
60 | 2 | $this->message, |
|
61 | [ |
||
62 | 2 | 'min' => $this->min, |
|
63 | ] |
||
64 | ) |
||
65 | ); |
||
66 | } |
||
67 | |||
68 | 4 | return $result; |
|
69 | } |
||
92 |