1 | <?php |
||
9 | class Arr |
||
10 | { |
||
11 | /** |
||
12 | * Determine whether the given value is array accessible. |
||
13 | * |
||
14 | * @param mixed $value |
||
15 | * |
||
16 | * @return bool |
||
17 | */ |
||
18 | 7 | public static function accessible($value): bool |
|
22 | |||
23 | /** |
||
24 | * Determine if the given key exists in the provided array. |
||
25 | * |
||
26 | * @param \ArrayAccess|array $array |
||
27 | * @param string|int $key |
||
28 | * |
||
29 | * @return bool |
||
30 | */ |
||
31 | 8 | public static function exists($array, $key): bool |
|
39 | |||
40 | /** |
||
41 | * Check if an item or items exist in an array using "dot" notation. |
||
42 | * |
||
43 | * @param \ArrayAccess|array $array |
||
44 | * @param array $keys |
||
45 | * |
||
46 | * @return bool |
||
47 | */ |
||
48 | 2 | public static function has($array, array $keys): bool |
|
70 | |||
71 | /** |
||
72 | * Get an item from an array using "dot" notation. |
||
73 | * |
||
74 | * @param \ArrayAccess|array $array |
||
75 | * @param string|null $key |
||
76 | * @param mixed $default |
||
77 | * |
||
78 | * @return mixed |
||
79 | */ |
||
80 | 6 | public static function get($array, ?string $key, $default = null) |
|
99 | |||
100 | /** |
||
101 | * Set an array item to a given value using "dot" notation. |
||
102 | * |
||
103 | * If no key is given to the method, the entire array will be replaced. |
||
104 | * |
||
105 | * @param array $array |
||
106 | * @param string $key |
||
107 | * @param mixed $value |
||
108 | * |
||
109 | * @return array |
||
110 | */ |
||
111 | public static function set(&$array, $key, $value): array |
||
132 | |||
133 | /** |
||
134 | * Remove one or many array items from a given array using "dot" notation. |
||
135 | * |
||
136 | * @param array $array |
||
137 | * @param array|string $keys |
||
138 | * |
||
139 | * @return void |
||
140 | */ |
||
141 | public static function forget(&$array, $keys): void |
||
168 | } |
||
169 |