Utility   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 29
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A arrayDepth() 0 16 4
1
<?php
2
3
namespace Acquia\LiftClient\Utility;
4
5
class Utility
6
{
7
    /**
8
     * Define the Depth of an array.
9
     * Proudly found elsewhere.
10
     *
11
     * @see http://stackoverflow.com/a/262944/3664381
12
     *
13
     * @param array $array
14
     *
15
     * @return int
16
     */
17 69
    public static function arrayDepth(array $array)
18
    {
19 69
        $max_depth = 1;
20
21 69
        foreach ($array as $value) {
22 69
            if (is_array($value)) {
23 21
                $depth = self::arrayDepth($value) + 1;
24
25 21
                if ($depth > $max_depth) {
26 37
                    $max_depth = $depth;
27 14
                }
28 14
            }
29 46
        }
30
31 69
        return $max_depth;
32
    }
33
}
34