@@ -68,7 +68,7 @@ |
||
68 | 68 | return "'".$field."'"; |
69 | 69 | } |
70 | 70 | |
71 | - private function getQueryFields($fields, $tbl){ |
|
71 | + private function getQueryFields($fields, $tbl) { |
|
72 | 72 | $startQuery = join(', ', $fields); |
73 | 73 | if (empty($fields)) { |
74 | 74 | $startQuery = $this->quote($tbl).'.*'; |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | $this->results = $stmt->fetch(\PDO::FETCH_OBJ); |
288 | 288 | |
289 | 289 | if(count($this->results) ){ |
290 | - // now turn this stdClass object to the object type of calling model |
|
291 | - $rows = $util->turnObject($this->className, $this->results); |
|
290 | + // now turn this stdClass object to the object type of calling model |
|
291 | + $rows = $util->turnObject($this->className, $this->results); |
|
292 | 292 | } |
293 | 293 | // Reset class variables |
294 | 294 | $this->reset(); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | $this->results = $stmt->fetchAll(\PDO::FETCH_ASSOC); |
300 | 300 | if(count($this->results) ){ |
301 | - $rows = $util->turnObjects($this->className, $this->results); |
|
301 | + $rows = $util->turnObjects($this->className, $this->results); |
|
302 | 302 | } |
303 | 303 | // Reset class variables |
304 | 304 | $this->reset(); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | protected $offset; |
73 | 73 | protected $results; |
74 | 74 | |
75 | - private function getFields(array $args, bool $quote = true){ |
|
75 | + private function getFields(array $args, bool $quote = true) { |
|
76 | 76 | $fldAr = array(); |
77 | 77 | $qb = new QueryBuilder(); |
78 | 78 | |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | public function where() |
138 | 138 | { |
139 | 139 | $args = func_get_args(); |
140 | - if(func_num_args()===2){ |
|
140 | + if (func_num_args() === 2) { |
|
141 | 141 | $this->where = array_merge($this->where, [[$args[0], '=', $args[1]]]); |
142 | 142 | return $this; |
143 | - } elseif(func_num_args()===3){ |
|
143 | + } elseif (func_num_args() === 3) { |
|
144 | 144 | $this->where = array_merge($this->where, [[$args[0], $args[1], $args[2]]]); |
145 | 145 | return $this; |
146 | 146 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | if ($fetchRows == 'first') { |
287 | 287 | $this->results = $stmt->fetch(\PDO::FETCH_OBJ); |
288 | 288 | |
289 | - if(count($this->results) ){ |
|
289 | + if (count($this->results)) { |
|
290 | 290 | // now turn this stdClass object to the object type of calling model |
291 | 291 | $rows = $util->turnObject($this->className, $this->results); |
292 | 292 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | $this->results = $stmt->fetchAll(\PDO::FETCH_ASSOC); |
300 | - if(count($this->results) ){ |
|
300 | + if (count($this->results)) { |
|
301 | 301 | $rows = $util->turnObjects($this->className, $this->results); |
302 | 302 | } |
303 | 303 | // Reset class variables |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | $row = $this->first(); |
384 | 384 | |
385 | - if($row == null ){ |
|
385 | + if ($row == null) { |
|
386 | 386 | throw new Exception("The record does not exists!"); |
387 | 387 | } |
388 | 388 | |
@@ -410,9 +410,9 @@ discard block |
||
410 | 410 | $qb = new QueryBuilder(); |
411 | 411 | $query = "TRUNCATE ".$this->table; |
412 | 412 | |
413 | - try{ |
|
413 | + try { |
|
414 | 414 | Connection::get()->query($qb->queryPrefix($query)); |
415 | - } catch(Exception $e){ |
|
415 | + } catch (Exception $e) { |
|
416 | 416 | throw new Exception($e->getMessage()); |
417 | 417 | } |
418 | 418 | |
@@ -448,14 +448,14 @@ discard block |
||
448 | 448 | $query = "UPDATE ".$this->table." SET "; |
449 | 449 | $ar = array(); |
450 | 450 | |
451 | - foreach($row as $key => $val){ |
|
451 | + foreach ($row as $key => $val) { |
|
452 | 452 | $ar[':'.$key] = $val; |
453 | - $query.= $qb->quote($key)." =:".$key.","; |
|
453 | + $query .= $qb->quote($key)." =:".$key.","; |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | $query = rtrim($query, ","); |
457 | 457 | |
458 | - try{ |
|
458 | + try { |
|
459 | 459 | $whereQuery = $wqb->buildAllWhereQuery( |
460 | 460 | $this->where, |
461 | 461 | $this->whereRaw, |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | $this->whereNull, |
465 | 465 | $this->whereNotNull |
466 | 466 | ); |
467 | - $query.= " ".join(" ", $whereQuery); |
|
467 | + $query .= " ".join(" ", $whereQuery); |
|
468 | 468 | $stmt = Connection::get()->prepare($qb->queryPrefix($query)); |
469 | 469 | $stmt->execute($ar); |
470 | 470 | $this->reset(); |
471 | - } catch(Exception $e){ |
|
471 | + } catch (Exception $e) { |
|
472 | 472 | throw new Exception($e->getMessage()); |
473 | 473 | } |
474 | 474 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $wqb = new WhereQueryBuilder(); |
489 | 489 | $query = "DELETE FROM ".$this->table; |
490 | 490 | |
491 | - try{ |
|
491 | + try { |
|
492 | 492 | $whereQuery = $wqb->buildAllWhereQuery( |
493 | 493 | $this->where, |
494 | 494 | $this->whereRaw, |
@@ -497,10 +497,10 @@ discard block |
||
497 | 497 | $this->whereNull, |
498 | 498 | $this->whereNotNull |
499 | 499 | ); |
500 | - $query.= " ".join(" ", $whereQuery); |
|
500 | + $query .= " ".join(" ", $whereQuery); |
|
501 | 501 | Connection::get()->query($qb->queryPrefix($query)); |
502 | 502 | $this->reset(); |
503 | - } catch(Exception $e){ |
|
503 | + } catch (Exception $e) { |
|
504 | 504 | throw new Exception($e->getMessage()); |
505 | 505 | } |
506 | 506 |