@@ -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 | - $row, |
|
| 450 | - $this->table, |
|
| 451 | - $this->where, |
|
| 452 | - $this->whereRaw, |
|
| 453 | - $this->whereIn, |
|
| 454 | - $this->whereNotIn, |
|
| 455 | - $this->whereNull, |
|
| 456 | - $this->whereNotNull |
|
| 449 | + $row, |
|
| 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 | $row, |
| 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 | |