Conditions | 3 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 3 | ||
Bugs | 0 | Features | 3 |
1 | <?php |
||
18 | function getin(/* ...$args */) |
||
19 | { |
||
20 | 2 | $args = func_get_args(); |
|
21 | |||
22 | $getin = function (array $xs, array $ks, $notfound = false) { |
||
23 | 2 | if (!array_key_exists(0, $ks)) { |
|
24 | 1 | return $notfound; |
|
25 | } |
||
26 | |||
27 | 2 | $x = get($xs, $ks[0], $notfound); |
|
28 | |||
29 | 2 | if (is_array($x)) { |
|
30 | 2 | return getin($x, array_slice($ks, 1), $notfound); |
|
31 | } |
||
32 | |||
33 | 2 | return $x; |
|
34 | 2 | }; |
|
35 | |||
36 | 2 | return call_user_func_array(partial($getin), $args); |
|
37 | } |
||
38 |