Created
March 2, 2015 10:40
-
-
Save IMSoP/4ea904203eadf8d5859a to your computer and use it in GitHub Desktop.
Simplified Sortable Interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This Interface allows to hook into the global Xsort() functions. | |
* @ingroup SPL | |
* @since PHP 7.0 | |
*/ | |
interface Sortable | |
{ | |
/** | |
* Sort the entries by values. | |
* | |
* @param callable $cmp_function | |
* For usort(), will be passed the user's comparison callback. | |
* For sort(), rsort(), natsort(), natcasesort(), will be passed a comparison defined by the engine. | |
*/ | |
public function sortValues(callable $cmp_function); | |
/** | |
* Sort the entries by values and maintain indexes. | |
* | |
* @param callable $cmp_function | |
* For uasort(), will be passed the user's comparison callback. | |
* For asort(), arsort(), will be passed a comparison defined by the engine. | |
*/ | |
public function sortValuesAssoc(callable $cmp_function); | |
/** | |
* Sort the entries by key. | |
* | |
* @param callable $cmp_function | |
* For uksort(), will be passed the user's comparison callback. | |
* For ksort(), krsort(), will be passed a comparison defined by the engine. | |
*/ | |
public function sortKeys(callable $cmp_function); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment