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