| Conditions | 5 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 5.675 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 2 | public static function removeEmptyElementsRecursively(array $array): array |
|
| 32 | { |
||
| 33 | 2 | $result = $array; |
|
| 34 | 2 | foreach ($result as $key => $value) { |
|
| 35 | 2 | if (is_array($value)) { |
|
| 36 | $result[$key] = self::removeEmptyElementsRecursively($value); |
||
| 37 | if ($result[$key] === []) { |
||
| 38 | unset($result[$key]); |
||
| 39 | } |
||
| 40 | 2 | } elseif ($value === null) { |
|
| 41 | 2 | unset($result[$key]); |
|
| 42 | } |
||
| 43 | } |
||
| 44 | 2 | return $result; |
|
| 45 | } |
||
| 47 |