@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | if(count($this->results) ){ |
302 | - // now turn this stdClass object to the object type of calling model |
|
303 | - $rows = $util->turnObjects($this->className, $this->results); |
|
302 | + // now turn this stdClass object to the object type of calling model |
|
303 | + $rows = $util->turnObjects($this->className, $this->results); |
|
304 | 304 | } |
305 | 305 | // Reset class variables |
306 | 306 | $this->reset(); |
@@ -446,14 +446,14 @@ discard block |
||
446 | 446 | public function update($row) |
447 | 447 | { |
448 | 448 | $result = (new UpdateQueryBuilder())->update( |
449 | - $rows, |
|
450 | - $this->table, |
|
451 | - $this->where, |
|
452 | - $this->whereRaw, |
|
453 | - $this->whereIn, |
|
454 | - $this->whereNotIn, |
|
455 | - $this->whereNull, |
|
456 | - $this->whereNotNull |
|
449 | + $rows, |
|
450 | + $this->table, |
|
451 | + $this->where, |
|
452 | + $this->whereRaw, |
|
453 | + $this->whereIn, |
|
454 | + $this->whereNotIn, |
|
455 | + $this->whereNull, |
|
456 | + $this->whereNotNull |
|
457 | 457 | ); |
458 | 458 | |
459 | 459 | $this->reset(); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | protected $offset; |
74 | 74 | protected $results; |
75 | 75 | |
76 | - private function getFields(array $args, bool $quote = true){ |
|
76 | + private function getFields(array $args, bool $quote = true) { |
|
77 | 77 | $fldAr = array(); |
78 | 78 | $qb = new QueryBuilder(); |
79 | 79 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | return $fldAr; |
87 | 87 | } |
88 | 88 | |
89 | - private function validateArgsCount($noOfArgs){ |
|
90 | - if($noOfArgs<2 || $noOfArgs >3){ |
|
89 | + private function validateArgsCount($noOfArgs) { |
|
90 | + if ($noOfArgs < 2 || $noOfArgs > 3) { |
|
91 | 91 | throw new Exception('Where parameter contains invalid number of parameters', 1); |
92 | 92 | } |
93 | 93 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $this->validateArgsCount($noOfArgs); |
150 | 150 | |
151 | - if($noOfArgs===2){ |
|
151 | + if ($noOfArgs === 2) { |
|
152 | 152 | $this->where = array_merge($this->where, [[$args[0], '=', $args[1]]]); |
153 | 153 | return $this; |
154 | 154 | } |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | |
295 | 295 | if ($fetchRows == 'first') { |
296 | 296 | $this->results = $stmt->fetch(\PDO::FETCH_OBJ); |
297 | - } else{ |
|
297 | + } else { |
|
298 | 298 | $this->results = $stmt->fetchAll(\PDO::FETCH_ASSOC); |
299 | 299 | } |
300 | 300 | |
301 | - if(count($this->results) ){ |
|
301 | + if (count($this->results)) { |
|
302 | 302 | // now turn this stdClass object to the object type of calling model |
303 | 303 | $rows = $util->turnObjects($this->className, $this->results); |
304 | 304 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | $row = $this->first(); |
386 | 386 | |
387 | - if($row == null ){ |
|
387 | + if ($row == null) { |
|
388 | 388 | throw new Exception("The record does not exists!"); |
389 | 389 | } |
390 | 390 | |
@@ -412,9 +412,9 @@ discard block |
||
412 | 412 | $qb = new QueryBuilder(); |
413 | 413 | $query = "TRUNCATE ".$this->table; |
414 | 414 | |
415 | - try{ |
|
415 | + try { |
|
416 | 416 | Connection::get()->query($qb->queryPrefix($query)); |
417 | - } catch(Exception $e){ |
|
417 | + } catch (Exception $e) { |
|
418 | 418 | throw new Exception($e->getMessage()); |
419 | 419 | } |
420 | 420 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function update($row) |
447 | 447 | { |
448 | - $result = (new UpdateQueryBuilder())->update( |
|
448 | + $result = (new UpdateQueryBuilder())->update( |
|
449 | 449 | $rows, |
450 | 450 | $this->table, |
451 | 451 | $this->where, |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | $wqb = new WhereQueryBuilder(); |
475 | 475 | $query = "DELETE FROM ".$this->table; |
476 | 476 | |
477 | - try{ |
|
477 | + try { |
|
478 | 478 | $whereQuery = $wqb->buildAllWhereQuery( |
479 | 479 | $this->where, |
480 | 480 | $this->whereRaw, |
@@ -483,10 +483,10 @@ discard block |
||
483 | 483 | $this->whereNull, |
484 | 484 | $this->whereNotNull |
485 | 485 | ); |
486 | - $query.= " ".join(" ", $whereQuery); |
|
486 | + $query .= " ".join(" ", $whereQuery); |
|
487 | 487 | Connection::get()->query($qb->queryPrefix($query)); |
488 | 488 | $this->reset(); |
489 | - } catch(Exception $e){ |
|
489 | + } catch (Exception $e) { |
|
490 | 490 | throw new Exception($e->getMessage()); |
491 | 491 | } |
492 | 492 |
@@ -26,14 +26,14 @@ |
||
26 | 26 | * @since v0.0.5 |
27 | 27 | */ |
28 | 28 | public function update( |
29 | - $row, |
|
30 | - $table, |
|
31 | - $where, |
|
32 | - $whereRaw, |
|
33 | - $whereIn, |
|
34 | - $whereNotIn, |
|
35 | - $whereNull, |
|
36 | - $whereNotNull |
|
29 | + $row, |
|
30 | + $table, |
|
31 | + $where, |
|
32 | + $whereRaw, |
|
33 | + $whereIn, |
|
34 | + $whereNotIn, |
|
35 | + $whereNull, |
|
36 | + $whereNotNull |
|
37 | 37 | ) |
38 | 38 | { |
39 | 39 | $wqb = new WhereQueryBuilder(); |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | $query = "UPDATE ".$table." SET "; |
41 | 41 | $ar = array(); |
42 | 42 | |
43 | - foreach($row as $key => $val){ |
|
43 | + foreach ($row as $key => $val) { |
|
44 | 44 | $ar[':'.$key] = $val; |
45 | - $query.= $this->quote($key)." =:".$key.","; |
|
45 | + $query .= $this->quote($key)." =:".$key.","; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $query = rtrim($query, ","); |
49 | 49 | |
50 | - try{ |
|
50 | + try { |
|
51 | 51 | $whereQuery = $wqb->buildAllWhereQuery( |
52 | 52 | $where, |
53 | 53 | $whereRaw, |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | $whereNull, |
57 | 57 | $whereNotNull |
58 | 58 | ); |
59 | - $query.= " ".join(" ", $whereQuery); |
|
59 | + $query .= " ".join(" ", $whereQuery); |
|
60 | 60 | $stmt = Connection::get()->prepare($this->queryPrefix($query)); |
61 | 61 | $stmt->execute($ar); |
62 | - } catch(Exception $e){ |
|
62 | + } catch (Exception $e) { |
|
63 | 63 | throw new Exception($e->getMessage()); |
64 | 64 | } |
65 | 65 |