Passed
Push — master ( 18ec32...6464dd )
by RN
03:11
created
src/Dolphin/Dolphin.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         
434 434
         $row = $this->first();
435 435
 
436
-        if($row == null ){
436
+        if ($row == null) {
437 437
             throw new Exception("The record does not exists!");
438 438
         }
439 439
 
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
         $qb = new QueryBuilder();
468 468
         $query = "TRUNCATE ".$this->table();
469 469
         
470
-        try{
470
+        try {
471 471
             Connection::get()->query($qb->queryPrefix($query));
472
-        } catch(Exception $e){
472
+        } catch (Exception $e) {
473 473
             throw new Exception($e->getMessage());
474 474
         }
475 475
 
@@ -507,20 +507,20 @@  discard block
 block discarded – undo
507 507
         $query = "UPDATE ".$this->table()." SET ";
508 508
         $ar = array();
509 509
         
510
-        foreach($row as $key => $val){
510
+        foreach ($row as $key => $val) {
511 511
             $ar[':'.$key] = $val;
512
-            $query.= $qb->quote($key)." =:".$key.",";
512
+            $query .= $qb->quote($key)." =:".$key.",";
513 513
         }
514 514
 
515 515
         $query = rtrim($query, ",");
516 516
         
517
-        try{
517
+        try {
518 518
             $whereQuery = $this->buildAllWhereQuery();
519
-            $query.= " ".join(" ", $whereQuery);
519
+            $query .= " ".join(" ", $whereQuery);
520 520
             $stmt = Connection::get()->prepare($qb->queryPrefix($query));
521 521
             $stmt->execute($ar);
522 522
             $this->reset();
523
-        } catch(Exception $e){
523
+        } catch (Exception $e) {
524 524
             throw new Exception($e->getMessage());
525 525
         }
526 526
 
@@ -540,12 +540,12 @@  discard block
 block discarded – undo
540 540
         $qb = new QueryBuilder();
541 541
         $query = "DELETE FROM ".$this->table();
542 542
         
543
-        try{
543
+        try {
544 544
             $whereQuery = $this->buildAllWhereQuery();
545
-            $query.= " ".join(" ", $whereQuery);
545
+            $query .= " ".join(" ", $whereQuery);
546 546
             Connection::get()->query($qb->queryPrefix($query));
547 547
             $this->reset();
548
-        } catch(Exception $e){
548
+        } catch (Exception $e) {
549 549
             throw new Exception($e->getMessage());
550 550
         }
551 551
 
Please login to merge, or discard this patch.
src/Dolphin/ORM.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@
 block discarded – undo
35 35
 
36 36
     public function __call($method, $parameters)
37 37
     {
38
-        $debug_backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT,2);
38
+        $debug_backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
39 39
         $calledClass = get_called_class();
40 40
         $object = new Dolphin();
41 41
         $object->tableName = $calledClass;
42 42
         
43
-        if(in_array($method,['save'])){
43
+        if (in_array($method, ['save'])) {
44 44
             $obj = new Save();
45 45
             $obj->tableName = $calledClass;
46 46
             return $obj->$method($debug_backtrace[0]['object']);
Please login to merge, or discard this patch.
src/Dolphin/Builders/InsertQueryBuilder.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -17,48 +17,48 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class InsertQueryBuilder extends QueryBuilder
19 19
 {
20
-    public function buildInsert($table, $obj){
20
+    public function buildInsert($table, $obj) {
21 21
         $qb = new QueryBuilder();
22 22
         $query = "INSERT INTO ".$table." (";
23
-        foreach($obj as $key => $val){
24
-            $query.= $qb->quote($key).", ";
23
+        foreach ($obj as $key => $val) {
24
+            $query .= $qb->quote($key).", ";
25 25
         }
26 26
         
27 27
         $query = rtrim($query, ", ");
28
-        $query.= ") VALUES ";
28
+        $query .= ") VALUES ";
29 29
         
30 30
         return $query;
31 31
     }
32 32
     
33
-    public function buildInsertPlaceholder($rows){
33
+    public function buildInsertPlaceholder($rows) {
34 34
         $ar = array();
35 35
         $query = "(";
36 36
         
37
-        foreach($rows as $key => $val){
37
+        foreach ($rows as $key => $val) {
38 38
             $ar[$key] = $val;
39
-            $query.= ":".$key.", ";
39
+            $query .= ":".$key.", ";
40 40
         }
41 41
         
42 42
         $query = rtrim($query, ", ");
43
-        $query.=") ";
43
+        $query .= ") ";
44 44
         
45 45
         return ['query' => $query, 'array' => $ar];
46 46
     }
47 47
     
48
-    public function buildInsertPlaceholders($rows){
48
+    public function buildInsertPlaceholders($rows) {
49 49
         $bindAr = array();
50 50
         $query = "";
51 51
         
52
-        foreach($rows as $i => $row){
53
-            $query.="(";
54
-            foreach($row as $key => $val){
55
-                $param = ":" . $key . $i;
56
-                $query.= $param.", ";
52
+        foreach ($rows as $i => $row) {
53
+            $query .= "(";
54
+            foreach ($row as $key => $val) {
55
+                $param = ":".$key.$i;
56
+                $query .= $param.", ";
57 57
                 $bindAr[$param] = $val;
58 58
             }
59 59
             
60 60
             $query = rtrim($query, ", ");
61
-            $query.="), ";
61
+            $query .= "), ";
62 62
         }
63 63
         
64 64
         $query = rtrim($query, ", ");
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $dataToBuild = $rows;
83 83
         $methodToCall = 'buildInsertPlaceholder';
84 84
         
85
-        if(is_array($rows) && isset($rows[0]) && is_array($rows[0])){
85
+        if (is_array($rows) && isset($rows[0]) && is_array($rows[0])) {
86 86
             $dataToBuild = $rows[0];
87 87
             $methodToCall = 'buildInsertPlaceholders';
88 88
         }
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
         $dataRet = $this->$methodToCall($rows);
92 92
         $returnQuery = $dataRet['query'];
93 93
         $bindAr = $dataRet['array'];
94
-        $query.= $returnQuery;
94
+        $query .= $returnQuery;
95 95
         
96
-        try{
96
+        try {
97 97
             $stmt = $db->prepare($qb->queryPrefix($query));
98 98
             
99
-            if(is_array($rows) && isset($rows[0]) && is_array($rows[0])){
100
-                foreach($bindAr as $param => $val){
99
+            if (is_array($rows) && isset($rows[0]) && is_array($rows[0])) {
100
+                foreach ($bindAr as $param => $val) {
101 101
                     $stmt->bindValue($param, $val);
102 102
                 }
103 103
                 
104 104
                 $stmt->execute();
105
-            } else{
105
+            } else {
106 106
                 $stmt->execute($bindAr);
107 107
             }
108
-        } catch(Exception $e){
108
+        } catch (Exception $e) {
109 109
             throw new Exception($e->getMessage());
110 110
         }
111 111
         
Please login to merge, or discard this patch.
src/Dolphin/Builders/WhereQueryBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  */
15 15
 class WhereQueryBuilder extends QueryBuilder
16 16
 {
17
-    protected function prepareArrayForWhere($bindKey, $bindVal = null){
17
+    protected function prepareArrayForWhere($bindKey, $bindVal = null) {
18 18
         $ar = $conditionAr = array();
19 19
         // expecting a string like 'status = :status'
20 20
         if ($this->checkWherePrepareUsed($bindKey)) {
Please login to merge, or discard this patch.
src/Dolphin/Save.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,36 +34,36 @@
 block discarded – undo
34 34
         $ar = array();
35 35
 
36 36
         // our object is set. Now we need to save it
37
-        if(isset($row) && isset($row->id) && $row->id > 0 ){
37
+        if (isset($row) && isset($row->id) && $row->id > 0) {
38 38
             $query = "UPDATE ".$this->table()." SET ";
39
-            foreach($row as $key => $val){
39
+            foreach ($row as $key => $val) {
40 40
                 $ar[':'.$key] = $val;
41
-                if($key == 'id') continue;
42
-                $query.= $qb->quote($key)." =:".$key.",";
41
+                if ($key == 'id') continue;
42
+                $query .= $qb->quote($key)." =:".$key.",";
43 43
             }
44 44
 
45 45
             $query = rtrim($query, ",");
46
-            $query.= " WHERE ".$qb->quote('id')."=:id";
47
-        } else{
46
+            $query .= " WHERE ".$qb->quote('id')."=:id";
47
+        } else {
48 48
             $query = "INSERT INTO ".$this->table()." (";
49
-            foreach($row as $key => $val){
50
-                $query.= $qb->quote($key).", ";
49
+            foreach ($row as $key => $val) {
50
+                $query .= $qb->quote($key).", ";
51 51
             }
52 52
 
53 53
             $query = rtrim($query, ", ");
54
-            $query.= ") VALUES (";
55
-            foreach($row as $key => $val){
54
+            $query .= ") VALUES (";
55
+            foreach ($row as $key => $val) {
56 56
                 $ar[$key] = $val;
57
-                $query.= ":".$key.", ";
57
+                $query .= ":".$key.", ";
58 58
             }
59 59
             $query = rtrim($query, ", ");
60
-            $query.=") ";
60
+            $query .= ") ";
61 61
         }
62 62
 
63
-        try{
63
+        try {
64 64
             $stmt = Connection::get()->prepare($qb->queryPrefix($query));
65 65
             $stmt->execute($ar);
66
-        } catch(Exception $e){
66
+        } catch (Exception $e) {
67 67
             throw new Exception($e->getMessage());
68 68
         }
69 69
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@
 block discarded – undo
38 38
             $query = "UPDATE ".$this->table()." SET ";
39 39
             foreach($row as $key => $val){
40 40
                 $ar[':'.$key] = $val;
41
-                if($key == 'id') continue;
41
+                if($key == 'id') {
42
+                    continue;
43
+                }
42 44
                 $query.= $qb->quote($key)." =:".$key.",";
43 45
             }
44 46
 
Please login to merge, or discard this patch.
src/Dolphin/Utils/Utils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
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
             $sourceReflection = new \ReflectionObject($sourceObject);
33 33
             $destinationReflection = new \ReflectionObject($destination);
34 34
             $sourceProperties = $sourceReflection->getProperties();
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
                 if ($destinationReflection->hasProperty($name)) {
42 42
                     $propDest = $destinationReflection->getProperty($name);
43 43
                     $propDest->setAccessible(true);
44
-                    $propDest->setValue($destination,$value);
44
+                    $propDest->setValue($destination, $value);
45 45
                 } else {
46 46
                     $destination->$name = $value;
47 47
                 }
Please login to merge, or discard this patch.
src/Dolphin/Config/Credentials.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         $dbCredentials = require('database.php');
16 16
         $var = $arguments[0];
17 17
 
18
-        if(array_key_exists($var, $dbCredentials)){
18
+        if (array_key_exists($var, $dbCredentials)) {
19 19
             return $dbCredentials[$var];
20 20
         }
21 21
 
Please login to merge, or discard this patch.