Conditions | 6 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
28 | 1 | public function toArray() : array |
|
29 | { |
||
30 | 1 | $fields = $this->getFields(); |
|
31 | |||
32 | 1 | $result = []; |
|
33 | 1 | foreach ($fields as $field => $value) { |
|
34 | 1 | if (!is_array($value)) { |
|
35 | 1 | $result[$field] = ($value instanceof ObjectInterface) ? $value->toArray() : $value; |
|
36 | 1 | continue; |
|
37 | } |
||
38 | |||
39 | 1 | foreach ($value as $key => $item) { |
|
40 | 1 | $result[$field][$key] = ($item instanceof ObjectInterface) ? $item->toArray() : $item; |
|
41 | } |
||
42 | } |
||
43 | |||
44 | 1 | return $result; |
|
45 | } |
||
67 |