| Conditions | 5 |
| Paths | 12 |
| Total Lines | 27 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 50 | 6 | protected function validateValue($value, DataSetInterface $dataSet = null): Result |
|
| 51 | { |
||
| 52 | 6 | $valid = false; |
|
| 53 | 6 | $filledCount = 0; |
|
| 54 | |||
| 55 | 6 | foreach ($this->alternativeAttributes as $attribute) { |
|
| 56 | 5 | $filledCount += $this->isEmpty($value->{$attribute}) ? 0 : 1; |
|
| 57 | } |
||
| 58 | |||
| 59 | 6 | if ($filledCount >= $this->min) { |
|
| 60 | 3 | $valid = true; |
|
| 61 | } |
||
| 62 | |||
| 63 | 6 | $result = new Result(); |
|
| 64 | |||
| 65 | 6 | if (!$valid) { |
|
| 66 | 3 | $result->addError( |
|
| 67 | 3 | $this->translateMessage( |
|
| 68 | 3 | $this->message, |
|
| 69 | [ |
||
| 70 | 3 | 'min' => $this->min, |
|
| 71 | ] |
||
| 72 | ) |
||
| 73 | ); |
||
| 74 | } |
||
| 75 | |||
| 76 | 6 | return $result; |
|
| 77 | } |
||
| 79 |