| Conditions | 6 |
| Paths | 7 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 1 | private function toArrayValueInsideToArrayTrait($value) |
|
| 25 | { |
||
| 26 | 1 | $isObject = is_object($value); |
|
| 27 | 1 | if ($isObject) { |
|
| 28 | 1 | $methodToArray = [$value, 'toArray']; |
|
| 29 | 1 | if (is_callable($methodToArray)) { |
|
| 30 | 1 | return call_user_func($methodToArray); |
|
| 31 | } |
||
| 32 | } |
||
| 33 | 1 | if ($isObject || is_array($value)) { |
|
| 34 | 1 | $children = []; |
|
| 35 | 1 | foreach ($value as $key => $child) { |
|
| 36 | 1 | $children[$key] = $this->toArrayValueInsideToArrayTrait($child); |
|
| 37 | } |
||
| 38 | 1 | return $children; |
|
| 39 | } |
||
| 40 | 1 | return $value; |
|
| 41 | } |
||
| 42 | } |
||
| 43 |