@@ -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 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $row = $this->first(); |
| 409 | 409 | |
| 410 | - if($row == null ){ |
|
| 410 | + if ($row == null) { |
|
| 411 | 411 | throw new Exception("The record does not exists!"); |
| 412 | 412 | } |
| 413 | 413 | |
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | $qb = new QueryBuilder(); |
| 436 | 436 | $query = "TRUNCATE ".$this->table; |
| 437 | 437 | |
| 438 | - try{ |
|
| 438 | + try { |
|
| 439 | 439 | Connection::get()->query($qb->queryPrefix($query)); |
| 440 | - } catch(Exception $e){ |
|
| 440 | + } catch (Exception $e) { |
|
| 441 | 441 | throw new Exception($e->getMessage()); |
| 442 | 442 | } |
| 443 | 443 | |
@@ -473,14 +473,14 @@ discard block |
||
| 473 | 473 | $query = "UPDATE ".$this->table." SET "; |
| 474 | 474 | $ar = array(); |
| 475 | 475 | |
| 476 | - foreach($row as $key => $val){ |
|
| 476 | + foreach ($row as $key => $val) { |
|
| 477 | 477 | $ar[':'.$key] = $val; |
| 478 | - $query.= $qb->quote($key)." =:".$key.","; |
|
| 478 | + $query .= $qb->quote($key)." =:".$key.","; |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | $query = rtrim($query, ","); |
| 482 | 482 | |
| 483 | - try{ |
|
| 483 | + try { |
|
| 484 | 484 | $whereQuery = $wqb->buildAllWhereQuery( |
| 485 | 485 | $this->where, |
| 486 | 486 | $this->whereIn, |
@@ -488,11 +488,11 @@ discard block |
||
| 488 | 488 | $this->whereNull, |
| 489 | 489 | $this->whereNotNull |
| 490 | 490 | ); |
| 491 | - $query.= " ".join(" ", $whereQuery); |
|
| 491 | + $query .= " ".join(" ", $whereQuery); |
|
| 492 | 492 | $stmt = Connection::get()->prepare($qb->queryPrefix($query)); |
| 493 | 493 | $stmt->execute($ar); |
| 494 | 494 | $this->reset(); |
| 495 | - } catch(Exception $e){ |
|
| 495 | + } catch (Exception $e) { |
|
| 496 | 496 | throw new Exception($e->getMessage()); |
| 497 | 497 | } |
| 498 | 498 | |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $wqb = new WhereQueryBuilder(); |
| 513 | 513 | $query = "DELETE FROM ".$this->table; |
| 514 | 514 | |
| 515 | - try{ |
|
| 515 | + try { |
|
| 516 | 516 | $whereQuery = $wqb->buildAllWhereQuery( |
| 517 | 517 | $this->where, |
| 518 | 518 | $this->whereIn, |
@@ -520,10 +520,10 @@ discard block |
||
| 520 | 520 | $this->whereNull, |
| 521 | 521 | $this->whereNotNull |
| 522 | 522 | ); |
| 523 | - $query.= " ".join(" ", $whereQuery); |
|
| 523 | + $query .= " ".join(" ", $whereQuery); |
|
| 524 | 524 | Connection::get()->query($qb->queryPrefix($query)); |
| 525 | 525 | $this->reset(); |
| 526 | - } catch(Exception $e){ |
|
| 526 | + } catch (Exception $e) { |
|
| 527 | 527 | throw new Exception($e->getMessage()); |
| 528 | 528 | } |
| 529 | 529 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function turnObject($destination, $sourceObject) |
| 29 | 29 | { |
| 30 | 30 | $destination = new $destination(); |
| 31 | - if(!is_object($sourceObject)){ |
|
| 31 | + if (!is_object($sourceObject)) { |
|
| 32 | 32 | return $destination; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ($destinationReflection->hasProperty($name)) { |
| 45 | 45 | $propDest = $destinationReflection->getProperty($name); |
| 46 | 46 | $propDest->setAccessible(true); |
| 47 | - $propDest->setValue($destination,$value); |
|
| 47 | + $propDest->setValue($destination, $value); |
|
| 48 | 48 | } else { |
| 49 | 49 | $destination->$name = $value; |
| 50 | 50 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | public function turnObjects($destination, $data) |
| 67 | 67 | { |
| 68 | 68 | $destination = new $destination(); |
| 69 | - if(count($data)){ |
|
| 69 | + if (count($data)) { |
|
| 70 | 70 | $destination->data = json_decode(json_encode($data, true)); |
| 71 | 71 | } |
| 72 | 72 | |