Upgrade to 3.5.6
This commit is contained in:
@@ -31,6 +31,27 @@ class A
|
||||
return $array + $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively loops through the array and
|
||||
* resolves any item defined as `Closure`,
|
||||
* applying the passed parameters
|
||||
* @since 3.5.6
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed ...$args Parameters to pass to the closures
|
||||
* @return array
|
||||
*/
|
||||
public static function apply(array $array, ...$args): array
|
||||
{
|
||||
array_walk_recursive($array, function (&$item) use ($args) {
|
||||
if (is_a($item, 'Closure')) {
|
||||
$item = $item(...$args);
|
||||
}
|
||||
});
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an element of an array by key
|
||||
*
|
||||
|
Reference in New Issue
Block a user