Upgrade to 3.2.3
This commit is contained in:
@@ -843,6 +843,26 @@ class Collection extends Iterator implements Countable
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sort arguments from a string
|
||||
*
|
||||
* @param string $sortBy
|
||||
* @return array
|
||||
*/
|
||||
public static function sortArgs(string $sortBy): array
|
||||
{
|
||||
$sortArgs = Str::split($sortBy, ' ');
|
||||
|
||||
// fill in PHP constants
|
||||
array_walk($sortArgs, function (string &$value) {
|
||||
if (Str::startsWith($value, 'SORT_') === true && defined($value) === true) {
|
||||
$value = constant($value);
|
||||
}
|
||||
});
|
||||
|
||||
return $sortArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the elements by any number of fields
|
||||
*
|
||||
|
Reference in New Issue
Block a user