lithium\util\Collection::sort()
Sorts the objects in the collection.
Parameters
-
string|callable
$sorterThe sorter for the data. Either a callable to use as the sort function or a string with the name of a well-known sort function like
'natsort'or a compare function like'strcmp'. Defaults to'sort'. -
array
$optionsReserved for future use.
Returns
CollectionReturns itself.
Links
Source
public function sort($sorter = 'sort', array $options = []) {
if (is_string($sorter) && strpos($sorter, 'sort') !== false && is_callable($sorter)) {
call_user_func_array($sorter, [&$this->_data]);
} elseif (is_callable($sorter)) {
usort($this->_data, $sorter);
}
return $this;
}