Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.7691 |
Changes | 0 |
1 | <?php |
||
17 | 6 | public static function arrayDepth(array $array) |
|
18 | { |
||
19 | 6 | $max_depth = 1; |
|
20 | |||
21 | 6 | foreach ($array as $value) { |
|
22 | 6 | if (is_array($value)) { |
|
23 | $depth = self::arrayDepth($value) + 1; |
||
24 | |||
25 | if ($depth > $max_depth) { |
||
26 | 2 | $max_depth = $depth; |
|
27 | } |
||
28 | } |
||
29 | 4 | } |
|
30 | |||
31 | 6 | return $max_depth; |
|
32 | } |
||
33 | } |
||
34 |