@@ -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 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | $row = $this->first(); |
| 418 | 418 | |
| 419 | - if($row == null ){ |
|
| 419 | + if ($row == null) { |
|
| 420 | 420 | throw new Exception("The record does not exists!"); |
| 421 | 421 | } |
| 422 | 422 | |
@@ -445,9 +445,9 @@ discard block |
||
| 445 | 445 | $qb = new QueryBuilder(); |
| 446 | 446 | $query = "TRUNCATE ".$this->table; |
| 447 | 447 | |
| 448 | - try{ |
|
| 448 | + try { |
|
| 449 | 449 | Connection::get()->query($qb->queryPrefix($query)); |
| 450 | - } catch(Exception $e){ |
|
| 450 | + } catch (Exception $e) { |
|
| 451 | 451 | throw new Exception($e->getMessage()); |
| 452 | 452 | } |
| 453 | 453 | |
@@ -484,20 +484,20 @@ discard block |
||
| 484 | 484 | $query = "UPDATE ".$this->table." SET "; |
| 485 | 485 | $ar = array(); |
| 486 | 486 | |
| 487 | - foreach($row as $key => $val){ |
|
| 487 | + foreach ($row as $key => $val) { |
|
| 488 | 488 | $ar[':'.$key] = $val; |
| 489 | - $query.= $qb->quote($key)." =:".$key.","; |
|
| 489 | + $query .= $qb->quote($key)." =:".$key.","; |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | $query = rtrim($query, ","); |
| 493 | 493 | |
| 494 | - try{ |
|
| 494 | + try { |
|
| 495 | 495 | $whereQuery = $this->buildAllWhereQuery(); |
| 496 | - $query.= " ".join(" ", $whereQuery); |
|
| 496 | + $query .= " ".join(" ", $whereQuery); |
|
| 497 | 497 | $stmt = Connection::get()->prepare($qb->queryPrefix($query)); |
| 498 | 498 | $stmt->execute($ar); |
| 499 | 499 | $this->reset(); |
| 500 | - } catch(Exception $e){ |
|
| 500 | + } catch (Exception $e) { |
|
| 501 | 501 | throw new Exception($e->getMessage()); |
| 502 | 502 | } |
| 503 | 503 | |
@@ -517,12 +517,12 @@ discard block |
||
| 517 | 517 | $qb = new QueryBuilder(); |
| 518 | 518 | $query = "DELETE FROM ".$this->table; |
| 519 | 519 | |
| 520 | - try{ |
|
| 520 | + try { |
|
| 521 | 521 | $whereQuery = $this->buildAllWhereQuery(); |
| 522 | - $query.= " ".join(" ", $whereQuery); |
|
| 522 | + $query .= " ".join(" ", $whereQuery); |
|
| 523 | 523 | Connection::get()->query($qb->queryPrefix($query)); |
| 524 | 524 | $this->reset(); |
| 525 | - } catch(Exception $e){ |
|
| 525 | + } catch (Exception $e) { |
|
| 526 | 526 | throw new Exception($e->getMessage()); |
| 527 | 527 | } |
| 528 | 528 | |