@@ -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 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | */ |
| 424 | 424 | public function update($row) |
| 425 | 425 | { |
| 426 | - $result = (new UpdateQueryBuilder())->update( |
|
| 426 | + $result = (new UpdateQueryBuilder())->update( |
|
| 427 | 427 | $row, |
| 428 | 428 | $this->table, |
| 429 | 429 | $this->where, |
@@ -451,9 +451,9 @@ discard block |
||
| 451 | 451 | $qb = new QueryBuilder(); |
| 452 | 452 | $query = "TRUNCATE ".$this->table; |
| 453 | 453 | |
| 454 | - try{ |
|
| 454 | + try { |
|
| 455 | 455 | Connection::get()->query($qb->queryPrefix($query)); |
| 456 | - } catch(Exception $e){ |
|
| 456 | + } catch (Exception $e) { |
|
| 457 | 457 | throw new Exception($e->getMessage()); |
| 458 | 458 | } |
| 459 | 459 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | */ |
| 470 | 470 | public function delete() |
| 471 | 471 | { |
| 472 | - $result = (new DeleteQueryBuilder())->delete( |
|
| 472 | + $result = (new DeleteQueryBuilder())->delete( |
|
| 473 | 473 | $this->table, |
| 474 | 474 | $this->where, |
| 475 | 475 | $this->whereRaw, |