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