1 | <?php declare(strict_types = 1); |
||
10 | class QueryBuilder |
||
11 | { |
||
12 | /** @var Collection */ |
||
13 | private $collection; |
||
14 | /** @var Expression */ |
||
15 | private $expression; |
||
16 | /** @var array */ |
||
17 | private $options; |
||
18 | /** @var int */ |
||
19 | private $queryType; |
||
20 | |||
21 | /** |
||
22 | * QueryBuilder constructor. |
||
23 | * |
||
24 | * @param Collection $collection |
||
25 | */ |
||
26 | 18 | public function __construct(Collection $collection) |
|
33 | |||
34 | /** |
||
35 | * Tells the query builder to execute a find |
||
36 | * |
||
37 | * @return $this |
||
38 | */ |
||
39 | 8 | public function find() |
|
43 | |||
44 | /** |
||
45 | * Tells the query builder to execute a count |
||
46 | * |
||
47 | * @return $this |
||
48 | */ |
||
49 | 1 | public function count() |
|
53 | |||
54 | /** |
||
55 | * @param int $type |
||
56 | * |
||
57 | * @return $this |
||
58 | */ |
||
59 | 9 | protected function setType(int $type) |
|
65 | |||
66 | /** |
||
67 | * Adds and filter |
||
68 | * |
||
69 | * @param array|Expression $expression |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function and($expression) |
||
79 | |||
80 | /** |
||
81 | * Adds or filter |
||
82 | * |
||
83 | * @param array|Expression $expression |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | 2 | public function or($expression) |
|
93 | |||
94 | /** |
||
95 | * Adds eq filter |
||
96 | * |
||
97 | * @param string $field |
||
98 | * @param mixed $value |
||
99 | * |
||
100 | * @return $this |
||
101 | */ |
||
102 | 1 | public function equal(string $field, $value) |
|
108 | |||
109 | /** |
||
110 | * Adds ne filter |
||
111 | * |
||
112 | * @param string $field |
||
113 | * @param mixed $value |
||
114 | * |
||
115 | * @return $this |
||
116 | */ |
||
117 | 2 | public function notEqual(string $field, $value) |
|
123 | |||
124 | /** |
||
125 | * Adds gt filter |
||
126 | * |
||
127 | * @param string $field |
||
128 | * @param mixed $value |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | |||
133 | public function greaterThan(string $field, $value) |
||
139 | |||
140 | /** |
||
141 | * Adds gte filter |
||
142 | * |
||
143 | * @param string $field |
||
144 | * @param mixed $value |
||
145 | * |
||
146 | * @return $this |
||
147 | */ |
||
148 | |||
149 | public function greaterEqualThan(string $field, $value) |
||
155 | |||
156 | /** |
||
157 | * Adds lt filter |
||
158 | * |
||
159 | * @param string $field |
||
160 | * @param mixed $value |
||
161 | * |
||
162 | * @return $this |
||
163 | */ |
||
164 | |||
165 | public function lowerThan(string $field, $value) |
||
171 | |||
172 | /** |
||
173 | * Adds lte filter |
||
174 | * |
||
175 | * @param string $field |
||
176 | * @param mixed $value |
||
177 | * |
||
178 | * @return $this |
||
179 | */ |
||
180 | |||
181 | public function lowerEqualThan(string $field, $value) |
||
187 | |||
188 | /** |
||
189 | * Adds in filter |
||
190 | * |
||
191 | * @param string $field |
||
192 | * @param array $values |
||
193 | * |
||
194 | * @return $this |
||
195 | */ |
||
196 | 1 | public function in(string $field, array $values) |
|
202 | |||
203 | /** |
||
204 | * Adds nin filter |
||
205 | * |
||
206 | * @param string $field |
||
207 | * @param array $values |
||
208 | * |
||
209 | * @return $this |
||
210 | */ |
||
211 | 1 | public function notIn(string $field, array $values) |
|
217 | |||
218 | /** |
||
219 | * Returns a new Query set up with the builder configuration |
||
220 | * |
||
221 | * @return Query |
||
222 | */ |
||
223 | 18 | public function getQuery(): Query |
|
232 | |||
233 | /** |
||
234 | * Returns the query type |
||
235 | * |
||
236 | * @return int |
||
237 | */ |
||
238 | 2 | public function getQueryType(): int |
|
242 | |||
243 | /** |
||
244 | * Sets the sort option |
||
245 | * |
||
246 | * @param array $fields |
||
247 | * |
||
248 | * @return $this |
||
249 | */ |
||
250 | 2 | public function sort(array $fields) |
|
254 | |||
255 | /** |
||
256 | * Sets the limit option |
||
257 | * |
||
258 | * @param int $limit |
||
259 | * |
||
260 | * @return $this |
||
261 | */ |
||
262 | 1 | public function limit(int $limit) |
|
266 | |||
267 | /** |
||
268 | * Sets the skip(offset) option |
||
269 | * |
||
270 | * @param int $skip |
||
271 | * |
||
272 | * @return $this |
||
273 | */ |
||
274 | 1 | public function skip(int $skip) |
|
278 | |||
279 | /** |
||
280 | * Sets the projection option |
||
281 | * |
||
282 | * @param array $projection |
||
283 | * |
||
284 | * @return $this |
||
285 | */ |
||
286 | 1 | public function select(...$projection) |
|
296 | |||
297 | /** |
||
298 | * Sets the an actually unsupported option |
||
299 | * @deprecated use the right method if supported |
||
300 | * |
||
301 | * @param string $option |
||
302 | * @param mixed $value |
||
303 | * |
||
304 | * @return $this |
||
305 | */ |
||
306 | 6 | public function setQueryOption(string $option, $value) |
|
312 | |||
313 | /** |
||
314 | * Returns a new Expression |
||
315 | * |
||
316 | * @return Expression |
||
317 | */ |
||
318 | 3 | public function expr(): Expression |
|
322 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.