Completed
Push — master ( 52ead2...fd316a )
by David
12s queued 10s
created

Utils   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A arrayFilterRec() 0 8 3
1
<?php
2
3
namespace TheAentMachine\AentDockerCompose\Service;
4
5
class Utils
6
{
7
    /**
8
     * Delete all key/value pairs with empty value by recursively using array_filter
9
     * @param array $input
10
     * @return mixed[] array
11
     */
12
    public static function arrayFilterRec(array $input): array
13
    {
14
        foreach ($input as &$value) {
15
            if (\is_array($value)) {
16
                $value = self::arrayFilterRec($value);
17
            }
18
        }
19
        return array_filter($input);
20
    }
21
}
22