@@ -29,7 +29,7 @@ public function all(): array
2929
3030 public function get ($ key , $ default = null )
3131 {
32- if (array_key_exists ($ key , $ this ->items )) {
32+ if (\ array_key_exists ($ key , $ this ->items )) {
3333 return $ this ->items [$ key ];
3434 }
3535
@@ -123,7 +123,7 @@ public function each(callable $callback)
123123 */
124124 public function unique ($ key = null , bool $ strict = false )
125125 {
126- if (is_null ($ key ) && false === $ strict ) {
126+ if (\ is_null ($ key ) && false === $ strict ) {
127127 return new self (array_unique ($ this ->items , SORT_REGULAR ));
128128 }
129129
@@ -132,7 +132,7 @@ public function unique($key = null, bool $strict = false)
132132 $ exists = [];
133133
134134 return $ this ->reject (function ($ item , $ key ) use ($ callback , $ strict , &$ exists ) {
135- if (in_array ($ id = $ callback ($ item , $ key ), $ exists , $ strict )) {
135+ if (\ in_array ($ id = $ callback ($ item , $ key ), $ exists , $ strict )) {
136136 return true ;
137137 }
138138
@@ -145,7 +145,7 @@ public function unique($key = null, bool $strict = false)
145145 */
146146 public function first (?callable $ callback = null , $ default = null )
147147 {
148- if (is_null ($ callback )) {
148+ if (\ is_null ($ callback )) {
149149 if (empty ($ this ->items )) {
150150 return $ default instanceof \Closure ? $ default () : $ default ;
151151 }
@@ -171,7 +171,7 @@ public function first(?callable $callback = null, $default = null)
171171 */
172172 public function firstWhere ($ key , $ operator = null , $ value = null )
173173 {
174- return $ this ->first ($ this ->operatorForWhere (...func_get_args ()));
174+ return $ this ->first ($ this ->operatorForWhere (...\ func_get_args ()));
175175 }
176176
177177 public function offsetExists ($ offset ): bool
@@ -190,7 +190,7 @@ public function offsetGet($offset)
190190
191191 public function offsetSet ($ offset , $ value ): void
192192 {
193- if (is_null ($ offset )) {
193+ if (\ is_null ($ offset )) {
194194 $ this ->items [] = $ value ;
195195 } else {
196196 $ this ->items [$ offset ] = $ value ;
@@ -204,7 +204,7 @@ public function offsetUnset($offset): void
204204
205205 public function count (): int
206206 {
207- return count ($ this ->items );
207+ return \ count ($ this ->items );
208208 }
209209
210210 public function getIterator (): \ArrayIterator
@@ -214,7 +214,7 @@ public function getIterator(): \ArrayIterator
214214
215215 private function getArrayableItems ($ items ): array
216216 {
217- if (is_array ($ items )) {
217+ if (\ is_array ($ items )) {
218218 return $ items ;
219219 }
220220
@@ -239,7 +239,7 @@ private function getArrayableItems($items): array
239239
240240 private function useAsCallable ($ value ): bool
241241 {
242- return !is_string ($ value ) && is_callable ($ value );
242+ return !\ is_string ($ value ) && \ is_callable ($ value );
243243 }
244244
245245 /**
@@ -261,23 +261,23 @@ private function valueRetriever($value)
261261 */
262262 private static function getDeepData ($ target , $ key , $ default = null )
263263 {
264- if (is_null ($ key )) {
264+ if (\ is_null ($ key )) {
265265 return $ target ;
266266 }
267267
268- $ key = is_array ($ key ) ? $ key : explode ('. ' , $ key );
268+ $ key = \ is_array ($ key ) ? $ key : explode ('. ' , $ key );
269269
270270 foreach ($ key as $ i => $ segment ) {
271271 unset($ key [$ i ]);
272272
273- if (is_null ($ segment )) {
273+ if (\ is_null ($ segment )) {
274274 return $ target ;
275275 }
276276
277277 if ('* ' === $ segment ) {
278278 if ($ target instanceof self) {
279279 $ target = $ target ->all ();
280- } elseif (!is_array ($ target )) {
280+ } elseif (!\ is_array ($ target )) {
281281 return $ default instanceof \Closure ? $ default () : $ default ;
282282 }
283283
@@ -287,12 +287,12 @@ private static function getDeepData($target, $key, $default = null)
287287 $ result [] = self ::getDeepData ($ item , $ key );
288288 }
289289
290- return in_array ('* ' , $ key , true ) ? self ::arrayCollapse ($ result ) : $ result ;
290+ return \ in_array ('* ' , $ key , true ) ? self ::arrayCollapse ($ result ) : $ result ;
291291 }
292292
293293 if (self ::accessible ($ target ) && self ::existsInArray ($ target , $ segment )) {
294294 $ target = $ target [$ segment ];
295- } elseif (is_object ($ target ) && isset ($ target ->{$ segment })) {
295+ } elseif (\ is_object ($ target ) && isset ($ target ->{$ segment })) {
296296 $ target = $ target ->{$ segment };
297297 } else {
298298 return $ default instanceof \Closure ? $ default () : $ default ;
@@ -309,7 +309,7 @@ public static function arrayCollapse(iterable $array): array
309309 foreach ($ array as $ values ) {
310310 if ($ values instanceof self) {
311311 $ values = $ values ->all ();
312- } elseif (!is_array ($ values )) {
312+ } elseif (!\ is_array ($ values )) {
313313 continue ;
314314 }
315315
@@ -321,7 +321,7 @@ public static function arrayCollapse(iterable $array): array
321321
322322 public static function accessible ($ value ): bool
323323 {
324- return is_array ($ value ) || $ value instanceof \ArrayAccess;
324+ return \ is_array ($ value ) || $ value instanceof \ArrayAccess;
325325 }
326326
327327 /**
@@ -336,18 +336,18 @@ private static function existsInArray($array, $key): bool
336336 return $ array ->offsetExists ($ key );
337337 }
338338
339- return array_key_exists ($ key , $ array );
339+ return \ array_key_exists ($ key , $ array );
340340 }
341341
342342 private function operatorForWhere (string $ key , ?string $ operator = null , $ value = null ): \Closure
343343 {
344- if (1 === func_num_args ()) {
344+ if (1 === \ func_num_args ()) {
345345 $ value = true ;
346346
347347 $ operator = '= ' ;
348348 }
349349
350- if (2 === func_num_args ()) {
350+ if (2 === \ func_num_args ()) {
351351 $ value = $ operator ;
352352
353353 $ operator = '= ' ;
@@ -356,10 +356,10 @@ private function operatorForWhere(string $key, ?string $operator = null, $value
356356 return static function ($ item ) use ($ key , $ operator , $ value ) {
357357 $ retrieved = self ::getDeepData ($ item , $ key );
358358
359- $ strings = array_filter ([$ retrieved , $ value ], fn ($ value ) => is_string ($ value ) || (is_object ($ value ) && method_exists ($ value , '__toString ' )));
359+ $ strings = array_filter ([$ retrieved , $ value ], fn ($ value ) => \ is_string ($ value ) || (\ is_object ($ value ) && method_exists ($ value , '__toString ' )));
360360
361- if (count ($ strings ) < 2 && 1 === count (array_filter ([$ retrieved , $ value ], 'is_object ' ))) {
362- return in_array ($ operator , ['!= ' , '<> ' , '!== ' ]);
361+ if (\ count ($ strings ) < 2 && 1 === \ count (array_filter ([$ retrieved , $ value ], 'is_object ' ))) {
362+ return \ in_array ($ operator , ['!= ' , '<> ' , '!== ' ]);
363363 }
364364
365365 switch ($ operator ) {
0 commit comments