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 in filter |
||
126 | * |
||
127 | * @param string $field |
||
128 | * @param array $values |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | 1 | public function in(string $field, array $values) |
|
138 | |||
139 | /** |
||
140 | * Adds nin filter |
||
141 | * |
||
142 | * @param string $field |
||
143 | * @param array $values |
||
144 | * |
||
145 | * @return $this |
||
146 | */ |
||
147 | 1 | public function notIn(string $field, array $values) |
|
153 | |||
154 | /** |
||
155 | * Returns a new Query set up with the builder configuration |
||
156 | * |
||
157 | * @return Query |
||
158 | */ |
||
159 | 18 | public function getQuery(): Query |
|
168 | |||
169 | /** |
||
170 | * Returns the query type |
||
171 | * |
||
172 | * @return int |
||
173 | */ |
||
174 | 2 | public function getQueryType(): int |
|
178 | |||
179 | /** |
||
180 | * Sets the sort option |
||
181 | * |
||
182 | * @param array $fields |
||
183 | * |
||
184 | * @return $this |
||
185 | */ |
||
186 | 2 | public function sort(array $fields) |
|
190 | |||
191 | /** |
||
192 | * Sets the limit option |
||
193 | * |
||
194 | * @param int $limit |
||
195 | * |
||
196 | * @return $this |
||
197 | */ |
||
198 | 1 | public function limit(int $limit) |
|
202 | |||
203 | /** |
||
204 | * Sets the skip(offset) option |
||
205 | * |
||
206 | * @param int $skip |
||
207 | * |
||
208 | * @return $this |
||
209 | */ |
||
210 | 1 | public function skip(int $skip) |
|
214 | |||
215 | /** |
||
216 | * Sets the projection option |
||
217 | * |
||
218 | * @param array $projection |
||
219 | * |
||
220 | * @return $this |
||
221 | */ |
||
222 | 1 | public function select(...$projection) |
|
232 | |||
233 | /** |
||
234 | * Sets the an actually unsupported option |
||
235 | * @deprecated use the right method if supported |
||
236 | * |
||
237 | * @param string $option |
||
238 | * @param mixed $value |
||
239 | * |
||
240 | * @return $this |
||
241 | */ |
||
242 | 6 | public function setQueryOption(string $option, $value) |
|
248 | |||
249 | /** |
||
250 | * Returns a new Expression |
||
251 | * |
||
252 | * @return Expression |
||
253 | */ |
||
254 | 3 | public function expr(): Expression |
|
258 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.