| Conditions | 6 |
| Paths | 12 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | public static function get(string $path, array $array, $default = null) |
||
| 10 | { |
||
| 11 | $splitPath = explode(self::ACCESS_SEPARATOR, $path); |
||
| 12 | |||
| 13 | while (is_array($array) && ($key = array_shift($splitPath))) { |
||
| 14 | if (array_key_exists($key, $array)) { |
||
| 15 | $array = &$array[$key]; |
||
| 16 | } else { |
||
| 17 | $array = null; |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | return is_null($array) || !empty($splitPath) ? $default : $array; |
||
| 22 | } |
||
| 60 | } |