| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3.009 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 45 | 1 | public function getNestedErrors(): array |
|
| 46 | { |
||
| 47 | 1 | $nestedErrors = []; |
|
| 48 | 1 | foreach ($this->errors as $error) { |
|
| 49 | 1 | $valuePath = $error->getValuePath(); |
|
| 50 | 1 | if ($valuePath === []) { |
|
| 51 | $nestedErrors[0][] = $error->getMessage(); |
||
| 52 | } else { |
||
| 53 | 1 | $errors = ArrayHelper::getValue($nestedErrors, $valuePath, []); |
|
| 54 | 1 | $errors[] = $error->getMessage(); |
|
| 55 | |||
| 56 | 1 | ArrayHelper::setValue($nestedErrors, $valuePath, $errors); |
|
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | 1 | return $nestedErrors; |
|
| 61 | } |
||
| 74 |