@@ -314,12 +314,12 @@ public static function existsAll($need, $arr, $type = false)
314
314
} else {
315
315
316
316
#以逗号分隔的会被拆开,组成数组
317
- if (strpos ($ need , ', ' ) !== false ) {
318
- $ need = explode (', ' , $ need );
317
+ if (\ strpos ($ need , ', ' ) !== false ) {
318
+ $ need = \ explode (', ' , $ need );
319
319
self ::existsAll ($ need , $ arr , $ type );
320
320
} else {
321
321
$ arr = self ::valueToLower ($ arr );//小写
322
- $ need = strtolower (trim ($ need ));//小写
322
+ $ need = \ strtolower (trim ($ need ));//小写
323
323
324
324
if (!\in_array ($ need , $ arr , $ type )) {
325
325
return $ need ;
@@ -355,7 +355,7 @@ public static function existsOne($need, $arr, $type = false): bool
355
355
}
356
356
357
357
$ arr = self ::changeValueCase ($ arr );//小写
358
- $ need = strtolower ($ need );//小写
358
+ $ need = \ strtolower ($ need );//小写
359
359
360
360
if (\in_array ($ need , $ arr , $ type )) {
361
361
return true ;
@@ -406,7 +406,9 @@ public static function getByPath($data, string $path, $default = null, string $s
406
406
return $ data [$ path ];
407
407
}
408
408
409
- if (!$ nodes = array_filter (explode ($ separator , $ path ))) {
409
+ // Error: will clear '0'. eg 'some-key.0'
410
+ // if (!$nodes = array_filter(explode($separator, $path))) {
411
+ if (!$ nodes = \explode ($ separator , $ path )) {
410
412
return $ default ;
411
413
}
412
414
@@ -486,7 +488,7 @@ public static function collapse($array): array
486
488
continue ;
487
489
}
488
490
489
- $ results = array_merge ($ results , $ values );
491
+ $ results = \ array_merge ($ results , $ values );
490
492
}
491
493
492
494
return $ results ;
@@ -499,10 +501,10 @@ public static function collapse($array): array
499
501
*/
500
502
public static function crossJoin (...$ arrays ): array
501
503
{
502
- return array_reduce ($ arrays , function ($ results , $ array ) {
503
- return static ::collapse (array_map (function ($ parent ) use ($ array ) {
504
- return array_map (function ($ item ) use ($ parent ) {
505
- return array_merge ($ parent , [$ item ]);
504
+ return \ array_reduce ($ arrays , function ($ results , $ array ) {
505
+ return static ::collapse (\ array_map (function ($ parent ) use ($ array ) {
506
+ return \ array_map (function ($ item ) use ($ parent ) {
507
+ return \ array_merge ($ parent , [$ item ]);
506
508
}, $ array );
507
509
}, $ results ));
508
510
}, [[]]);
@@ -530,7 +532,7 @@ public static function dot($array, $prepend = ''): array
530
532
531
533
foreach ($ array as $ key => $ value ) {
532
534
if (\is_array ($ value ) && !empty ($ value )) {
533
- $ results = array_merge ($ results , static ::dot ($ value , $ prepend . $ key . '. ' ));
535
+ $ results = \ array_merge ($ results , static ::dot ($ value , $ prepend . $ key . '. ' ));
534
536
} else {
535
537
$ results [$ prepend . $ key ] = $ value ;
536
538
}
@@ -677,7 +679,7 @@ public static function flatten($array, $depth = INF): array
677
679
* @param array|string $keys
678
680
* @return void
679
681
*/
680
- public static function forget (&$ array , $ keys ): void
682
+ public static function forget (&$ array , $ keys )
681
683
{
682
684
$ original = &$ array ;
683
685
$ keys = (array )$ keys ;
0 commit comments