@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | public function where() |
| 140 | 140 | { |
| 141 | 141 | $args = func_get_args(); |
| 142 | - if(func_num_args()===2){ |
|
| 142 | + if (func_num_args() === 2) { |
|
| 143 | 143 | $this->where = array_merge($this->where, [[$args[0], '=', $args[1]]]); |
| 144 | - } elseif(func_num_args()===3){ |
|
| 144 | + } elseif (func_num_args() === 3) { |
|
| 145 | 145 | $this->where = array_merge($this->where, [[$args[0], $args[1], $args[2]]]); |
| 146 | - } else{ |
|
| 146 | + } else { |
|
| 147 | 147 | throw new Exception('Where parameter contains invalid number of parameters', 1); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | $row = $this->first(); |
| 410 | 410 | |
| 411 | - if($row == null ){ |
|
| 411 | + if ($row == null) { |
|
| 412 | 412 | throw new Exception("The record does not exists!"); |
| 413 | 413 | } |
| 414 | 414 | |
@@ -437,9 +437,9 @@ discard block |
||
| 437 | 437 | $qb = new QueryBuilder(); |
| 438 | 438 | $query = "TRUNCATE ".$this->table; |
| 439 | 439 | |
| 440 | - try{ |
|
| 440 | + try { |
|
| 441 | 441 | Connection::get()->query($qb->queryPrefix($query)); |
| 442 | - } catch(Exception $e){ |
|
| 442 | + } catch (Exception $e) { |
|
| 443 | 443 | throw new Exception($e->getMessage()); |
| 444 | 444 | } |
| 445 | 445 | |
@@ -477,14 +477,14 @@ discard block |
||
| 477 | 477 | $query = "UPDATE ".$this->table." SET "; |
| 478 | 478 | $ar = array(); |
| 479 | 479 | |
| 480 | - foreach($row as $key => $val){ |
|
| 480 | + foreach ($row as $key => $val) { |
|
| 481 | 481 | $ar[':'.$key] = $val; |
| 482 | - $query.= $qb->quote($key)." =:".$key.","; |
|
| 482 | + $query .= $qb->quote($key)." =:".$key.","; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | $query = rtrim($query, ","); |
| 486 | 486 | |
| 487 | - try{ |
|
| 487 | + try { |
|
| 488 | 488 | $whereQuery = $wqb->buildAllWhereQuery( |
| 489 | 489 | $this->where, |
| 490 | 490 | $this->whereIn, |
@@ -492,11 +492,11 @@ discard block |
||
| 492 | 492 | $this->whereNull, |
| 493 | 493 | $this->whereNotNull |
| 494 | 494 | ); |
| 495 | - $query.= " ".join(" ", $whereQuery); |
|
| 495 | + $query .= " ".join(" ", $whereQuery); |
|
| 496 | 496 | $stmt = Connection::get()->prepare($qb->queryPrefix($query)); |
| 497 | 497 | $stmt->execute($ar); |
| 498 | 498 | $this->reset(); |
| 499 | - } catch(Exception $e){ |
|
| 499 | + } catch (Exception $e) { |
|
| 500 | 500 | throw new Exception($e->getMessage()); |
| 501 | 501 | } |
| 502 | 502 | |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | $wqb = new WhereQueryBuilder(); |
| 518 | 518 | $query = "DELETE FROM ".$this->table; |
| 519 | 519 | |
| 520 | - try{ |
|
| 520 | + try { |
|
| 521 | 521 | $whereQuery = $wqb->buildAllWhereQuery( |
| 522 | 522 | $this->where, |
| 523 | 523 | $this->whereIn, |
@@ -525,10 +525,10 @@ discard block |
||
| 525 | 525 | $this->whereNull, |
| 526 | 526 | $this->whereNotNull |
| 527 | 527 | ); |
| 528 | - $query.= " ".join(" ", $whereQuery); |
|
| 528 | + $query .= " ".join(" ", $whereQuery); |
|
| 529 | 529 | Connection::get()->query($qb->queryPrefix($query)); |
| 530 | 530 | $this->reset(); |
| 531 | - } catch(Exception $e){ |
|
| 531 | + } catch (Exception $e) { |
|
| 532 | 532 | throw new Exception($e->getMessage()); |
| 533 | 533 | } |
| 534 | 534 | |