Upgrade to 3.2.3

This commit is contained in:
Bastian Allgeier
2019-08-06 10:24:12 +02:00
parent 40f095f5de
commit 02be32bb75
48 changed files with 356 additions and 114 deletions

View File

@@ -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
*