@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function select(string $fields = '*', string $add = '', array $values = null, bool $returnModel = false, bool $debug = false) |
29 | 29 | { |
30 | - if (strlen($add) > 0) { |
|
30 | + if (strlen($add)>0) { |
|
31 | 31 | $add = ' ' . $add; |
32 | 32 | } |
33 | 33 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $numparams = substr($numparams, 1); |
67 | 67 | $sql = "INSERT INTO {$this->getTableName()} ({$fields}) VALUES ({$numparams})"; |
68 | 68 | if ($debug) { |
69 | - echo $sql.'<pre>'.print_r($values).'</pre>'; |
|
69 | + echo $sql . '<pre>' . print_r($values) . '</pre>'; |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | $result = $this->executeSQL($sql, $values); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $sql .= " WHERE $where"; |
149 | 149 | } |
150 | 150 | if ($debug) { |
151 | - echo $sql.'<pre>'.print_r($values).'</pre>'; |
|
151 | + echo $sql . '<pre>' . print_r($values) . '</pre>'; |
|
152 | 152 | return; |
153 | 153 | } |
154 | 154 | $result = $this->executeSQL($sql, $values); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $sql .= " WHERE $where"; |
224 | 224 | } |
225 | 225 | if ($debug) { |
226 | - echo $sql.'<pre>'.print_r($values).'</pre>'; |
|
226 | + echo $sql . '<pre>' . print_r($values) . '</pre>'; |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 | $result = $this->executeSQL($sql, $values); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | protected function orderBy(string $parameter, $order = null): self |
188 | 188 | { |
189 | 189 | try { |
190 | - $query = "ORDER BY {$parameter} ".($order ?? 'ASC'); |
|
190 | + $query = "ORDER BY {$parameter} " . ($order ?? 'ASC'); |
|
191 | 191 | $this->add($query, "orderBy"); |
192 | 192 | return $this; |
193 | 193 | } catch (\PDOException $e) { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | protected function addOrderBy(string $parameter, $order = null): self |
204 | 204 | { |
205 | 205 | try { |
206 | - $query = ", {$parameter} ".($order ?? 'ASC')." "; |
|
206 | + $query = ", {$parameter} " . ($order ?? 'ASC') . " "; |
|
207 | 207 | $this->add($query, "addOrderBy"); |
208 | 208 | return $this; |
209 | 209 | } catch (\PDOException $e) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | protected function limit(string $texto): self |
219 | 219 | { |
220 | 220 | $query = "LIMIT {$texto}"; |
221 | - $this->add($query,"limit"); |
|
221 | + $this->add($query, "limit"); |
|
222 | 222 | return $this; |
223 | 223 | } |
224 | 224 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | { |
231 | 231 | try { |
232 | 232 | $query = "OFFSET {$texto}"; |
233 | - $this->add($query,"offset"); |
|
233 | + $this->add($query, "offset"); |
|
234 | 234 | return $this; |
235 | 235 | } catch (\PDOException $e) { |
236 | 236 | $this->setError($e); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | try { |
247 | 247 | $query = "GROUP BY {$texto}"; |
248 | - $this->add($query,"groupBy"); |
|
248 | + $this->add($query, "groupBy"); |
|
249 | 249 | return $this; |
250 | 250 | } catch (\PDOException $e) { |
251 | 251 | $this->setError($e); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | { |
261 | 261 | try { |
262 | 262 | $query = "HAVING {$texto}"; |
263 | - $this->add($query,"having"); |
|
263 | + $this->add($query, "having"); |
|
264 | 264 | return $this; |
265 | 265 | } catch (\PDOException $e) { |
266 | 266 | $this->setError($e); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | { |
276 | 276 | try { |
277 | 277 | $query = "AND {$texto}"; |
278 | - $this->add($query,"andHaving"); |
|
278 | + $this->add($query, "andHaving"); |
|
279 | 279 | return $this; |
280 | 280 | } catch (\PDOException $e) { |
281 | 281 | $this->setError($e); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | { |
291 | 291 | try { |
292 | 292 | $query = "OR {$codition}"; |
293 | - $this->add($query,"orHaving"); |
|
293 | + $this->add($query, "orHaving"); |
|
294 | 294 | return $this; |
295 | 295 | } catch (\PDOException $e) { |
296 | 296 | $this->setError($e); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | { |
308 | 308 | try { |
309 | 309 | $query = "INNER JOIN {$table} AS {$alias} ON $codition"; |
310 | - $this->add($query,"join"); |
|
310 | + $this->add($query, "join"); |
|
311 | 311 | return $this; |
312 | 312 | } catch (\PDOException $e) { |
313 | 313 | $this->setError($e); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | { |
325 | 325 | try { |
326 | 326 | $query = "LEFT JOIN {$table} AS {$alias} ON {$codition}"; |
327 | - $this->add($query,"join"); |
|
327 | + $this->add($query, "join"); |
|
328 | 328 | return $this; |
329 | 329 | } catch (\PDOException $e) { |
330 | 330 | $this->setError($e); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | { |
342 | 342 | try { |
343 | 343 | $query = "RIGHT JOIN {$table} AS {$alias} ON $codition"; |
344 | - $this->add($query,"join"); |
|
344 | + $this->add($query, "join"); |
|
345 | 345 | return $this; |
346 | 346 | } catch (\PDOException $e) { |
347 | 347 | $this->setError($e); |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | protected function executeQuery(): self |
355 | 355 | { |
356 | 356 | try { |
357 | - foreach ($this->sqlPartsSelect as $key => $part){ |
|
357 | + foreach ($this->sqlPartsSelect as $key => $part) { |
|
358 | 358 | if (is_array($part)) { |
359 | - foreach ($part as $item){ |
|
360 | - $this->setQuery($this->getQuery().$item); |
|
359 | + foreach ($part as $item) { |
|
360 | + $this->setQuery($this->getQuery() . $item); |
|
361 | 361 | } |
362 | 362 | } else { |
363 | - $this->setQuery($this->getQuery().$part); |
|
363 | + $this->setQuery($this->getQuery() . $part); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | */ |
395 | 395 | private function add(string $query, string $type, array $params = []): void |
396 | 396 | { |
397 | - $query = $query." "; |
|
397 | + $query = $query . " "; |
|
398 | 398 | try { |
399 | 399 | if (is_array($this->sqlPartsSelect[$type])) { |
400 | 400 | $this->sqlPartsSelect[$type][] = $query; |