1 | <?php |
||
5 | class Order |
||
6 | { |
||
7 | /** |
||
8 | * @var string $expr The expression to use into the order |
||
9 | */ |
||
10 | protected $expr; |
||
11 | |||
12 | /** |
||
13 | * @var string|null $sort The sort order : ASC or DESC |
||
14 | */ |
||
15 | protected $sort; |
||
16 | |||
17 | /** |
||
18 | * Define the expression and the order to sort |
||
19 | * |
||
20 | * @param string $expr The expression to use into the order |
||
21 | * @param string|null $sort The sort order : ASC or DESC |
||
22 | */ |
||
23 | public function __construct(string $expr, $sort = 'ASC') |
||
28 | |||
29 | /** |
||
30 | * Getter accessor to property expr |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | public function getExpr(): string |
||
38 | |||
39 | /** |
||
40 | * Getter accessor to property expr |
||
41 | * |
||
42 | * @return string|null |
||
43 | */ |
||
44 | public function getSort() |
||
48 | |||
49 | /** |
||
50 | * Generate the sql query for to this order expression |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | public function generate(): string |
||
71 | } |
||
72 |