| Total Complexity | 1 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | abstract class Comparator |
||
| 23 | { |
||
| 24 | |||
| 25 | /** |
||
| 26 | * static constant for sorting order ascending |
||
| 27 | */ |
||
| 28 | const ORDER_ASC = "ASC"; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * static constant for sorting order descending |
||
| 32 | */ |
||
| 33 | const ORDER_DESC = "DESC"; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * static constant for a custom sorting order |
||
| 37 | */ |
||
| 38 | const ORDER_CUSTOM = "CUSTOM"; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * defines the order (ascending|descending) for a comparison |
||
| 42 | * |
||
| 43 | * @var string |
||
| 44 | */ |
||
| 45 | protected $sortingOrder; |
||
|
|
|||
| 46 | |||
| 47 | /** |
||
| 48 | * object/array which can be used to define a custom order |
||
| 49 | * @var mixed |
||
| 50 | */ |
||
| 51 | protected $customOrder; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Comparator constructor. |
||
| 55 | * @param string $sortingOrder defines the order (ascending|descending) for a comparison |
||
| 56 | * @param mixed $customOrder |
||
| 57 | */ |
||
| 58 | 3 | public function __construct($sortingOrder = self::ORDER_ASC, $customOrder = null) |
|
| 62 | 3 | } |
|
| 63 | |||
| 64 | /** |
||
| 65 | * Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first |
||
| 66 | * argument is less than, equal to, or greater than the second. |
||
| 67 | * |
||
| 68 | * @param Comparable $a |
||
| 69 | * @param Comparable $b |
||
| 70 | * @return int |
||
| 71 | */ |
||
| 72 | public abstract function compare(Comparable $a, Comparable $b); |
||
| 73 | } |
||
| 74 |