| Conditions | 5 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5.0729 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 1 | protected function validateValue($value, DataSetInterface $dataSet = null): Result |
|
| 25 | { |
||
| 26 | 1 | $result = new Result(); |
|
| 27 | 1 | if (!is_iterable($value)) { |
|
| 28 | $result->addError($this->incorrectInputMessage); |
||
| 29 | return $result; |
||
| 30 | } |
||
| 31 | |||
| 32 | 1 | foreach ($value as $item) { |
|
| 33 | 1 | $itemResult = $this->rules->validate($item, $dataSet); |
|
| 34 | 1 | if ($itemResult->isValid() === false) { |
|
| 35 | 1 | foreach ($itemResult->getErrors() as $error) { |
|
| 36 | 1 | $message = $this->formatMessage($this->message, [ |
|
| 37 | 1 | 'error' => $error, |
|
| 38 | 1 | 'value' => $item, |
|
| 39 | ]); |
||
| 40 | 1 | $result->addError($message); |
|
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | 1 | return $result; |
|
| 46 | } |
||
| 48 |