| Conditions | 6 |
| Paths | 6 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | public function getArrayCopy() |
||
| 43 | { |
||
| 44 | $array = get_object_vars($this); |
||
| 45 | |||
| 46 | foreach ($array as $key => &$value) { |
||
| 47 | if ($value instanceof Base) { |
||
| 48 | $array[$key] = $value->getArrayCopy(); |
||
| 49 | } elseif (is_array($value)) { |
||
| 50 | foreach ($value as $k => $v) { |
||
| 51 | if ($v instanceof Base) { |
||
| 52 | $value[$k] = $v->getArrayCopy(); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | $array = array_filter($array, function ($value) { |
||
| 59 | return $value !== null; |
||
| 60 | }); |
||
| 61 | |||
| 62 | return $array; |
||
| 63 | } |
||
| 64 | |||
| 85 |