1 | <?php |
||
13 | class QueryModifierBuilder { |
||
14 | |||
15 | /** |
||
16 | * @var string[] list of modifiers including limit, offset and order by |
||
17 | */ |
||
18 | private $modifiers = array(); |
||
19 | |||
20 | /** |
||
21 | * @var ExpressionValidator |
||
22 | */ |
||
23 | private $expressionValidator; |
||
24 | |||
25 | /** |
||
26 | * @var UsageValidator |
||
27 | */ |
||
28 | private $usageValidator; |
||
29 | |||
30 | public function __construct( UsageValidator $usageValidator ) { |
||
34 | |||
35 | /** |
||
36 | * Sets the GROUP BY modifiers. |
||
37 | * |
||
38 | * @param string[] $expressions |
||
39 | */ |
||
40 | public function groupBy( array $expressions ) { |
||
52 | |||
53 | /** |
||
54 | * Sets the HAVING modifier. |
||
55 | * |
||
56 | * @param string $expression |
||
57 | */ |
||
58 | public function having( $expression ) { |
||
65 | |||
66 | /** |
||
67 | * Sets the ORDER BY modifier. |
||
68 | * |
||
69 | * @param string $expression |
||
70 | * @param string $direction one of ASC or DESC |
||
71 | * @throws InvalidArgumentException |
||
72 | */ |
||
73 | public function orderBy( $expression, $direction = 'ASC' ) { |
||
87 | |||
88 | /** |
||
89 | * Sets the LIMIT modifier. |
||
90 | * |
||
91 | * @param int $limit |
||
92 | * @throws InvalidArgumentException |
||
93 | */ |
||
94 | public function limit( $limit ) { |
||
101 | |||
102 | /** |
||
103 | * Sets the OFFSET modifier. |
||
104 | * |
||
105 | * @param int $offset |
||
106 | * @throws InvalidArgumentException |
||
107 | */ |
||
108 | public function offset( $offset ) { |
||
115 | |||
116 | /** |
||
117 | * Returns the plain SPARQL string of these modifiers. |
||
118 | * |
||
119 | * @return string |
||
120 | */ |
||
121 | public function getSPARQL() { |
||
129 | |||
130 | } |
||
131 |