Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
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 |