| Conditions | 5 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 5.675 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 2 | public static function removeEmptyElementsRecursively(array $array): array |
|
| 17 | { |
||
| 18 | 2 | $result = $array; |
|
| 19 | 2 | foreach ($result as $key => $value) { |
|
| 20 | 2 | if (is_array($value)) { |
|
| 21 | $result[$key] = self::removeEmptyElementsRecursively($value); |
||
| 22 | if ($result[$key] === []) { |
||
| 23 | unset($result[$key]); |
||
| 24 | } |
||
| 25 | 2 | } elseif ($value === null) { |
|
| 26 | 2 | unset($result[$key]); |
|
| 27 | } |
||
| 28 | } |
||
| 29 | 2 | return $result; |
|
| 30 | } |
||
| 32 |