Passed
Push — master ( 2452cb...36c8a5 )
by RN
01:50
created
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.
src/Dolphin/ORM.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 
27 27
     public function __call($method, $parameters)
28 28
     {
29
-        if($method== 'asArray'){
29
+        if ($method == 'asArray') {
30 30
             // $obj = new Utils();
31 31
         }
32 32
     }
Please login to merge, or discard this patch.
src/Dolphin/Parsers/WhereQueryParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 class WhereQueryParser
14 14
 {
15 15
 
16
-    protected function prepareArrayForWhere($bindKey, $bindVal = null){
16
+    protected function prepareArrayForWhere($bindKey, $bindVal = null) {
17 17
         $ar = $conditionAr = array();
18 18
         // expecting a string like 'status = :status'
19 19
         if ($this->checkWherePrepareUsed($bindKey)) {
Please login to merge, or discard this patch.
src/Dolphin/Utils/Utils.php 1 patch
Spacing   +3 added lines, -3 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
             return $destination;
33 33
         }
34 34
         
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Dolphin/Save.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,33 +22,33 @@  discard block
 block discarded – undo
22 22
         $this->qb = new QueryBuilder();
23 23
     }
24 24
 
25
-    public function buildQueryStrSingleFromArr($row = array()){
25
+    public function buildQueryStrSingleFromArr($row = array()) {
26 26
       $ar = [];
27 27
       $query = "UPDATE ".$this->table." SET ";
28
-      foreach($row as $key => $val){
28
+      foreach ($row as $key => $val) {
29 29
           $ar[':'.$key] = $val;
30
-          if($key == 'id') continue;
31
-          $query.= $this->qb->quote($key)." =:".$key.",";
30
+          if ($key == 'id') continue;
31
+          $query .= $this->qb->quote($key)." =:".$key.",";
32 32
       }
33 33
       $query = rtrim($query, ",");
34 34
 
35 35
       return ['ar' => $ar, 'query' => $query];
36 36
     }
37
-    public function createQuery($row){
37
+    public function createQuery($row) {
38 38
         $ar = [];
39
-        if(isset($row) && isset($row->id) && $row->id > 0 ){
39
+        if (isset($row) && isset($row->id) && $row->id > 0) {
40 40
             $mixedData = $this->buildQueryStrSingleFromArr($row);
41
-            $query= $mixedData['query']." WHERE ".$this->qb->quote('id')."=:id";
41
+            $query = $mixedData['query']." WHERE ".$this->qb->quote('id')."=:id";
42 42
 
43 43
             return ['query' => $query, 'data' => $mixedData['ar']];
44 44
         }
45 45
 
46 46
         $queryVal = '';
47 47
         $query = "INSERT INTO ".$this->table." (";
48
-        foreach($row as $key => $val){
49
-            $query.= $this->qb->quote($key).", ";
48
+        foreach ($row as $key => $val) {
49
+            $query .= $this->qb->quote($key).", ";
50 50
             $ar[$key] = $val;
51
-            $queryVal.= ":".$key.", ";
51
+            $queryVal .= ":".$key.", ";
52 52
         }
53 53
 
54 54
         $query = rtrim($query, ", ").") VALUES (".$queryVal.rtrim($query, ", ").") ";
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 
74 74
         list($query, $data) = $this->createQuery($row);
75 75
 
76
-        try{
76
+        try {
77 77
             $stmt = Connection::get()->prepare($this->qb->queryPrefix($query));
78 78
             $stmt->execute($data);
79
-        } catch(Exception $e){
79
+        } catch (Exception $e) {
80 80
             throw new Exception($e->getMessage());
81 81
         }
82 82
 
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
@@ -16,55 +16,55 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class InsertQueryBuilder extends QueryBuilder
18 18
 {
19
-    private function buildInsert($table, $obj){
19
+    private function buildInsert($table, $obj) {
20 20
         $qb = new QueryBuilder();
21 21
         $query = "INSERT INTO ".$table." (";
22
-        foreach($obj as $key => $val){
23
-            $query.= $qb->quote($key).", ";
22
+        foreach ($obj as $key => $val) {
23
+            $query .= $qb->quote($key).", ";
24 24
         }
25 25
 
26 26
         $query = rtrim($query, ", ");
27
-        $query.= ") VALUES ";
27
+        $query .= ") VALUES ";
28 28
 
29 29
         return $query;
30 30
     }
31 31
 
32
-    private function buildInsertPlaceholder($rows){
32
+    private function buildInsertPlaceholder($rows) {
33 33
         $ar = array();
34 34
         $query = "(";
35 35
 
36
-        foreach($rows as $key => $val){
36
+        foreach ($rows as $key => $val) {
37 37
             $ar[$key] = $val;
38
-            $query.= ":".$key.", ";
38
+            $query .= ":".$key.", ";
39 39
         }
40 40
 
41 41
         $query = rtrim($query, ", ");
42
-        $query.=") ";
42
+        $query .= ") ";
43 43
 
44 44
         return ['query' => $query, 'array' => $ar];
45 45
     }
46 46
 
47
-    private function buildInsertPlaceholders($rows){
47
+    private function buildInsertPlaceholders($rows) {
48 48
         $bindAr = array();
49 49
         $query = "";
50 50
 
51
-        foreach($rows as $i => $row){
52
-            $query.="(";
53
-            foreach($row as $key => $val){
54
-                $param = ":" . $key . $i;
55
-                $query.= $param.", ";
51
+        foreach ($rows as $i => $row) {
52
+            $query .= "(";
53
+            foreach ($row as $key => $val) {
54
+                $param = ":".$key.$i;
55
+                $query .= $param.", ";
56 56
                 $bindAr[$param] = $val;
57 57
             }
58 58
 
59 59
             $query = rtrim($query, ", ");
60
-            $query.="), ";
60
+            $query .= "), ";
61 61
         }
62 62
 
63 63
         $query = rtrim($query, ", ");
64 64
         return ['query' => $query, 'array' => $bindAr];
65 65
     }
66 66
 
67
-    private function checkMultipleInsert($rows = array()){
67
+    private function checkMultipleInsert($rows = array()) {
68 68
       return is_array($rows) && isset($rows[0]) && is_array($rows[0]);
69 69
     }
70 70
     /**
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
         $dataToBuild = $rows;
84 84
         $methodToCall = 'buildInsertPlaceholder';
85 85
 
86
-        if($this->checkMultipleInsert($rows)){
86
+        if ($this->checkMultipleInsert($rows)) {
87 87
             $dataToBuild = $rows[0];
88 88
             $methodToCall = 'buildInsertPlaceholders';
89 89
         }
90 90
 
91 91
         $query   = $this->buildInsert($table, $dataToBuild);
92 92
         $dataRet = $this->$methodToCall($rows);
93
-        $query.= $dataRet['query'];
93
+        $query .= $dataRet['query'];
94 94
         $bindAr = $dataRet['array'];
95 95
 
96
-        try{
96
+        try {
97 97
             $stmt = $db->prepare($this->queryPrefix($query));
98 98
 
99
-            if($this->checkMultipleInsert($rows)){
100
-                foreach($bindAr as $param => $val){
99
+            if ($this->checkMultipleInsert($rows)) {
100
+                foreach ($bindAr as $param => $val) {
101 101
                     $stmt->bindValue($param, $val);
102 102
                 }
103 103
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
             $stmt->execute($bindAr);
109 109
             return $db->lastInsertId();
110
-        } catch(Exception $e){
110
+        } catch (Exception $e) {
111 111
             throw new Exception($e->getMessage());
112 112
         }
113 113
     }
Please login to merge, or discard this patch.
src/Dolphin/Builders/UpdateQueryBuilder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
         $query = "UPDATE ".$table." SET ";
41 41
         $ar    = array();
42 42
 
43
-        foreach($row as $key => $val){
43
+        foreach ($row as $key => $val) {
44 44
             $ar[':'.$key] = $val;
45
-            $query.= $this->quote($key)." =:".$key.",";
45
+            $query .= $this->quote($key)." =:".$key.",";
46 46
         }
47 47
 
48 48
         $query = rtrim($query, ",");
49 49
 
50
-        try{
50
+        try {
51 51
             $whereQuery = $wqb->buildAllWhereQuery(
52 52
                                 $where,
53 53
                                 $whereRaw,
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
                                 $whereNull,
57 57
                                 $whereNotNull
58 58
                             );
59
-            $query.= " ".join(" ", $whereQuery);
59
+            $query .= " ".join(" ", $whereQuery);
60 60
             $stmt = Connection::get()->prepare($this->queryPrefix($query));
61 61
             $stmt->execute($ar);
62
-        } catch(Exception $e){
62
+        } catch (Exception $e) {
63 63
             throw new Exception($e->getMessage());
64 64
         }
65 65
 
Please login to merge, or discard this patch.
src/Dolphin/Builders/DeleteQueryBuilder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         $wqb = new WhereQueryBuilder();
39 39
         $query = "DELETE FROM ".$table;
40 40
 
41
-        try{
41
+        try {
42 42
             $whereQuery = $wqb->buildAllWhereQuery(
43 43
                                     $where,
44 44
                                     $whereRaw,
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
                                     $whereNull,
48 48
                                     $whereNotNull
49 49
                                 );
50
-            $query.= " ".join(" ", $whereQuery);
50
+            $query .= " ".join(" ", $whereQuery);
51 51
             Connection::get()->query($this->queryPrefix($query));
52
-        } catch(Exception $e){
52
+        } catch (Exception $e) {
53 53
             throw new Exception($e->getMessage());
54 54
         }
55 55
 
Please login to merge, or discard this patch.
src/Dolphin/Builders/WhereQueryBuilder.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 {
18 18
     private $qb;
19 19
 
20
-    public function __construct(){
20
+    public function __construct() {
21 21
         $this->qb = new QueryBuilder();
22 22
     }
23 23
 
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
         return null;
36 36
     }
37 37
 
38
-    private function whereAddedCondition($conditions = []){
38
+    private function whereAddedCondition($conditions = []) {
39 39
       return $this->whereAdded === false && count($conditions);
40 40
     }
41 41
 
42 42
     public function buildWhereQuery($conditions = [])
43 43
     {
44 44
         $whereQuery = [];
45
-        if (count($conditions)<=0) {
45
+        if (count($conditions) <= 0) {
46 46
             return [];
47 47
         }
48 48
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         foreach ($conditions as $where) {
56 56
             $sign = '=';
57 57
             $whereQueryPart = 'AND ';
58
-            if(count($where)==3) {
58
+            if (count($where) == 3) {
59 59
                 $sign = $where[1];
60 60
             }
61 61
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         $whereRawQuery = [];
75 75
 
76
-        if (count($conditions)<=0) {
76
+        if (count($conditions) <= 0) {
77 77
             return $query;
78 78
         }
79 79
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
         return $query;
99 99
     }
100 100
 
101
-    private function buildWhereInNotInQuery($conditions = [], $queryParam='IN')
101
+    private function buildWhereInNotInQuery($conditions = [], $queryParam = 'IN')
102 102
     {
103 103
         $query = [];
104 104
 
105
-        if (count($conditions)<=0) {
105
+        if (count($conditions) <= 0) {
106 106
             return $query;
107 107
         }
108 108
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $whereQuery = [];
147 147
 
148
-        if (count($conditions)<=0) {
148
+        if (count($conditions) <= 0) {
149 149
             return $query;
150 150
         }
151 151
 
Please login to merge, or discard this patch.