Conditions | 5 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 12 |
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 | return $result->addError($this->incorrectInputMessage); |
||
29 | } |
||
30 | |||
31 | foreach ($value as $item) { |
||
32 | $itemResult = $this->rules->validate($item, $dataSet); |
||
33 | if ($itemResult->isValid() === false) { |
||
34 | foreach ($itemResult->getErrors() as $error) { |
||
35 | $message = $this->formatMessage($this->message, [ |
||
36 | 'error' => $error, |
||
37 | 'value' => $item, |
||
38 | ]); |
||
39 | $result = $result->addError($message); |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 | |||
44 | return $result; |
||
45 | } |
||
47 |