1 | <?php |
||
7 | class ResultOrdering |
||
8 | { |
||
9 | /** @var array */ |
||
10 | private $orderBy; |
||
11 | |||
12 | /** @var bool */ |
||
13 | private $required; |
||
14 | |||
15 | /** |
||
16 | * ResultOrdering constructor |
||
17 | * The parameter orderBy must contain the list of aggregates and the order they must use |
||
18 | * [$aggregate1 => $order1, $aggregate2 => $order2, ... ] |
||
19 | * |
||
20 | * @param array $orderBy |
||
21 | */ |
||
22 | 9 | public function __construct(array $orderBy) |
|
33 | |||
34 | /** |
||
35 | * Method to make comparisons |
||
36 | * |
||
37 | * @param Result $a |
||
38 | * @param Result $b |
||
39 | * @return int |
||
40 | */ |
||
41 | 3 | public function orderItems(Result $a, Result $b) |
|
54 | |||
55 | /** |
||
56 | * Return if ordering is required based on the orderBy array |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | 9 | public function isRequired() |
|
64 | |||
65 | /** |
||
66 | * Internal method to check two numerical values and return 0, -1 or 1 |
||
67 | * |
||
68 | * @param string $field |
||
69 | * @param Result $a |
||
70 | * @param Result $b |
||
71 | * @return int |
||
72 | */ |
||
73 | 3 | protected function comparePivotValues($field, Result $a, Result $b) |
|
77 | } |
||
78 |