<?php /** * @file * SortInterface.php * * @author: marand * * @license General Public License version 2 or later */ namespace OSInet\Sort; interface SortInterface { /** * @param string $type * The name of the sort algorithm: bubble, heap, insertion, merge, quick, * selection, and so on. * * @return SortInterface */ public static function create($type); /** * @param array $data * The data to sort. It will not be modified in place. * @param callable $comparison * The comparison callback. It must take two Sortable parameters, and * return less than 0 if the first is lower than the second, 0 if they are * equal, and more than 0 if the first is higher than the second. It may * take a third array parameter, which will receive the $options array. * @param array $options * A hash of options for the comparison function. * * @return array * The sorted version of the input data. */ public function sort($data, $comparison, $options = array()); }