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