Extends
lithium\core\Object
Sorts the objects in the collection.
Parameters
- callable $sorter The sorter for the data, can either be a sort function like natsort or a compare function like strcmp.
- array $options The available options are: - No options yet implemented
Returns
$this, useful for chaining this with other methods.Source
public function sort($sorter = 'sort', array $options = array()) {
if (is_string($sorter) && strpos($sorter, 'sort') !== false && is_callable($sorter)) {
call_user_func_array($sorter, array(&$this->_data));
} else if (is_callable($sorter)) {
usort($this->_data, $sorter);
}
return $this;
}