| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | 2 | public function getNestedErrors(): array |
|
| 38 | { |
||
| 39 | 2 | $nestedErrors = []; |
|
| 40 | 2 | foreach ($this->errors as $error) { |
|
| 41 | 2 | $valuePath = $error->getValuePath(); |
|
| 42 | 2 | if ($valuePath === []) { |
|
| 43 | 1 | $nestedErrors[0][] = $error->getMessage(); |
|
| 44 | } else { |
||
| 45 | 2 | $errors = ArrayHelper::getValue($nestedErrors, $valuePath, []); |
|
| 46 | 2 | $errors[] = $error->getMessage(); |
|
| 47 | |||
| 48 | 2 | ArrayHelper::setValue($nestedErrors, $valuePath, $errors); |
|
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | 2 | return $nestedErrors; |
|
| 53 | } |
||
| 74 |