| Conditions | 5 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5.0909 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 2 | protected function validateValue($value, DataSetInterface $dataSet = null): Result |
|
| 32 | { |
||
| 33 | 2 | $result = new Result(); |
|
| 34 | 2 | if (!is_iterable($value)) { |
|
| 35 | $result->addError($this->incorrectInputMessage); |
||
| 36 | return $result; |
||
| 37 | } |
||
| 38 | |||
| 39 | 2 | foreach ($value as $item) { |
|
| 40 | 2 | $itemResult = $this->rules->validate($item, $dataSet); |
|
| 41 | 2 | if ($itemResult->isValid() === false) { |
|
| 42 | 2 | foreach ($itemResult->getErrors() as $error) { |
|
| 43 | 2 | $result->addError( |
|
| 44 | 2 | $this->message, |
|
| 45 | 2 | ['error' => $error, 'value' => $item] |
|
| 46 | ); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | 2 | return $result; |
|
| 52 | } |
||
| 66 |