| 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 |
||
| 43 | 4 | protected function validateValue($value, DataSetInterface $dataSet = null): Result |
|
| 44 | { |
||
| 45 | 4 | $filledCount = 0; |
|
| 46 | |||
| 47 | 4 | foreach ($this->attributes as $attribute) { |
|
| 48 | 4 | if (!$this->isEmpty($value->{$attribute})) { |
|
| 49 | 3 | $filledCount++; |
|
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | 4 | $result = new Result(); |
|
| 54 | |||
| 55 | 4 | if ($filledCount < $this->min) { |
|
| 56 | 2 | $result->addError( |
|
| 57 | 2 | $this->translateMessage( |
|
| 58 | 2 | $this->message, |
|
| 59 | [ |
||
| 60 | 2 | 'min' => $this->min, |
|
| 61 | ] |
||
| 62 | ) |
||
| 63 | ); |
||
| 64 | } |
||
| 65 | |||
| 66 | 4 | return $result; |
|
| 67 | } |
||
| 80 |