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