Conditions | 5 |
Paths | 4 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public static function get($index, $default = null) |
||
46 | { |
||
47 | if (self::$battery->offsetExists($index)) { |
||
48 | return self::$battery->offsetGet($index); |
||
49 | } |
||
50 | |||
51 | $array = self::$battery->getArrayCopy(); |
||
52 | |||
53 | foreach ((array)explode('.', $index) as $segment) { |
||
54 | |||
55 | if (!is_array($array) || !array_key_exists($segment, $array)) { |
||
56 | return $default; |
||
57 | } |
||
58 | |||
59 | $array = $array[$segment]; |
||
60 | } |
||
61 | |||
62 | return $array; |
||
63 | } |
||
64 | } |
||
65 |