@@ -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 | } |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | $row = $this->first(); |
| 380 | 380 | |
| 381 | - if($row == null ){ |
|
| 381 | + if ($row == null) { |
|
| 382 | 382 | throw new Exception("The record does not exists!"); |
| 383 | 383 | } |
| 384 | 384 | |
@@ -406,9 +406,9 @@ discard block |
||
| 406 | 406 | $qb = new QueryBuilder(); |
| 407 | 407 | $query = "TRUNCATE ".$this->table; |
| 408 | 408 | |
| 409 | - try{ |
|
| 409 | + try { |
|
| 410 | 410 | Connection::get()->query($qb->queryPrefix($query)); |
| 411 | - } catch(Exception $e){ |
|
| 411 | + } catch (Exception $e) { |
|
| 412 | 412 | throw new Exception($e->getMessage()); |
| 413 | 413 | } |
| 414 | 414 | |
@@ -444,14 +444,14 @@ discard block |
||
| 444 | 444 | $query = "UPDATE ".$this->table." SET "; |
| 445 | 445 | $ar = array(); |
| 446 | 446 | |
| 447 | - foreach($row as $key => $val){ |
|
| 447 | + foreach ($row as $key => $val) { |
|
| 448 | 448 | $ar[':'.$key] = $val; |
| 449 | - $query.= $qb->quote($key)." =:".$key.","; |
|
| 449 | + $query .= $qb->quote($key)." =:".$key.","; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | $query = rtrim($query, ","); |
| 453 | 453 | |
| 454 | - try{ |
|
| 454 | + try { |
|
| 455 | 455 | $whereQuery = $wqb->buildAllWhereQuery( |
| 456 | 456 | $this->where, |
| 457 | 457 | $this->whereIn, |
@@ -459,11 +459,11 @@ discard block |
||
| 459 | 459 | $this->whereNull, |
| 460 | 460 | $this->whereNotNull |
| 461 | 461 | ); |
| 462 | - $query.= " ".join(" ", $whereQuery); |
|
| 462 | + $query .= " ".join(" ", $whereQuery); |
|
| 463 | 463 | $stmt = Connection::get()->prepare($qb->queryPrefix($query)); |
| 464 | 464 | $stmt->execute($ar); |
| 465 | 465 | $this->reset(); |
| 466 | - } catch(Exception $e){ |
|
| 466 | + } catch (Exception $e) { |
|
| 467 | 467 | throw new Exception($e->getMessage()); |
| 468 | 468 | } |
| 469 | 469 | |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $wqb = new WhereQueryBuilder(); |
| 484 | 484 | $query = "DELETE FROM ".$this->table; |
| 485 | 485 | |
| 486 | - try{ |
|
| 486 | + try { |
|
| 487 | 487 | $whereQuery = $wqb->buildAllWhereQuery( |
| 488 | 488 | $this->where, |
| 489 | 489 | $this->whereIn, |
@@ -491,10 +491,10 @@ discard block |
||
| 491 | 491 | $this->whereNull, |
| 492 | 492 | $this->whereNotNull |
| 493 | 493 | ); |
| 494 | - $query.= " ".join(" ", $whereQuery); |
|
| 494 | + $query .= " ".join(" ", $whereQuery); |
|
| 495 | 495 | Connection::get()->query($qb->queryPrefix($query)); |
| 496 | 496 | $this->reset(); |
| 497 | - } catch(Exception $e){ |
|
| 497 | + } catch (Exception $e) { |
|
| 498 | 498 | throw new Exception($e->getMessage()); |
| 499 | 499 | } |
| 500 | 500 | |