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