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