Lines Matching defs:array
14 * Get an item from an array using "dot" notation.
16 * @param \ArrayAccess|array $array
21 public static function get($array, $key, $default = null)
25 if (!static::accessible($array)) {
29 return $array;
31 if (static::exists($array, $key)) {
32 return $array[$key];
35 return $array[$key] ?? $default;
38 if (static::accessible($array) && static::exists($array, $segment)) {
39 $array = $array[$segment];
44 return $array;
48 * Determine whether the given value is array accessible.
59 * Determine if the given key exists in the provided array.
61 * @param \ArrayAccess|array $array
65 protected static function exists($array, $key)
67 if ($array instanceof \ArrayAccess) {
68 return $array->offsetExists($key);
70 return array_key_exists($key, $array);