Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | public static function getValueByKey($key = '', $data, $default = null) |
||
14 | { |
||
15 | if(empty($key)) return $data; |
||
16 | |||
17 | $indexes = explode('.', $key); |
||
18 | |||
19 | $value = $data; |
||
20 | |||
21 | foreach ($indexes as $index) { |
||
22 | if(!isset($value[$index])) return $default; |
||
23 | |||
24 | $value = $value[$index]; |
||
25 | } |
||
26 | |||
27 | return $value; |
||
28 | } |
||
29 | } |