1 | <?php |
||
24 | class QueryBuilder |
||
25 | { |
||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private $query = []; |
||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $sContext; |
||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $sPrefixedContext; |
||
38 | /** |
||
39 | * @var string|null |
||
40 | */ |
||
41 | private $sReturnedClass; |
||
42 | |||
43 | /** |
||
44 | * QueryBuilder constructor. |
||
45 | * |
||
46 | * @param string|null $returnedClass |
||
47 | * |
||
48 | * @throws \mrcnpdlk\MojePanstwo\Exception |
||
49 | */ |
||
50 | 8 | private function __construct(string $returnedClass) |
|
69 | |||
70 | /** |
||
71 | * @param string|null $returnedClass |
||
72 | * |
||
73 | * @return \mrcnpdlk\MojePanstwo\QueryBuilder |
||
74 | */ |
||
75 | 8 | public static function create(string $returnedClass): QueryBuilder |
|
79 | |||
80 | /** |
||
81 | * @param string $layerName |
||
82 | * |
||
83 | * @return $this |
||
84 | */ |
||
85 | public function addLayer(string $layerName) |
||
91 | |||
92 | /** |
||
93 | * Find object having ID |
||
94 | * |
||
95 | * @param string|int $id |
||
96 | * |
||
97 | * @return mixed |
||
98 | * @throws \mrcnpdlk\MojePanstwo\Exception |
||
99 | */ |
||
100 | 2 | public function find($id) |
|
109 | |||
110 | /** |
||
111 | * Search result |
||
112 | * |
||
113 | * @return SearchResponse |
||
114 | * @throws \mrcnpdlk\MojePanstwo\Exception |
||
115 | */ |
||
116 | 6 | public function get(): SearchResponse |
|
147 | |||
148 | /** |
||
149 | * Return params as formatted string |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | 8 | public function getQuery(): string |
|
168 | |||
169 | /** |
||
170 | * @param int $limit |
||
171 | * |
||
172 | * @return $this |
||
173 | */ |
||
174 | 6 | public function limit(int $limit = 50) |
|
180 | |||
181 | /** |
||
182 | * Order by option settings |
||
183 | * |
||
184 | * @param string $property |
||
185 | * @param string $order |
||
186 | * |
||
187 | * @return $this |
||
188 | */ |
||
189 | public function orderBy(string $property, string $order = 'asc') |
||
200 | |||
201 | /** |
||
202 | * Get page number |
||
203 | * |
||
204 | * @param int $page |
||
205 | * |
||
206 | * @return $this |
||
207 | */ |
||
208 | public function page(int $page = 1) |
||
214 | |||
215 | /** |
||
216 | * Where option settings |
||
217 | * |
||
218 | * @param string $property |
||
219 | * @param $value |
||
220 | * |
||
221 | * @return $this |
||
222 | */ |
||
223 | public function where(string $property = null, $value) |
||
237 | |||
238 | /** |
||
239 | * Full text search WHERE |
||
240 | * |
||
241 | * @param $value |
||
242 | * |
||
243 | * @return $this |
||
244 | */ |
||
245 | public function whereQ($value) |
||
251 | |||
252 | } |
||
253 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.