Passed
Push — master ( 36c8a5...213898 )
by RN
01:43
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/Utils/Utils.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,16 +50,16 @@
 block discarded – undo
50 50
         return $destination;
51 51
     }
52 52
     
53
-     /**
54
-     * Turn the stadClass object to the type of calling Model
55
-     *
56
-     * @param String $destination
57
-     * @param Object $sourceObject
58
-     * @return Object $destination
59
-     *
60
-     * @author RN Kushwaha <[email protected]>
61
-     * @since v0.0.5
62
-     */
53
+        /**
54
+         * Turn the stadClass object to the type of calling Model
55
+         *
56
+         * @param String $destination
57
+         * @param Object $sourceObject
58
+         * @return Object $destination
59
+         *
60
+         * @author RN Kushwaha <[email protected]>
61
+         * @since v0.0.5
62
+         */
63 63
     public function turnObjects($destination, $data)
64 64
     {
65 65
         $destination = new $destination();
Please login to merge, or discard this 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((!is_null($data)) && count($data)){
69
+        if ((!is_null($data)) && 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 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@
 block discarded – undo
27 27
       $query = "UPDATE ".$this->table." SET ";
28 28
       foreach($row as $key => $val){
29 29
           $ar[':'.$key] = $val;
30
-          if($key == 'id') continue;
30
+          if($key == 'id') {
31
+              continue;
32
+          }
31 33
           $query.= $this->qb->quote($key)." =:".$key.",";
32 34
       }
33 35
       $query = rtrim($query, ",");
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@
 block discarded – undo
23 23
     }
24 24
 
25 25
     public function buildQueryStrSingleFromArr($row = []){
26
-      $ar = [];
27
-      $query = "UPDATE ".$this->table." SET ";
28
-      foreach($row as $key => $val){
29
-          $ar[':'.$key] = $val;
30
-          if($key == 'id') continue;
31
-          $query.= $this->qb->quote($key)." =:".$key.",";
32
-      }
33
-      $query = rtrim($query, ",");
26
+        $ar = [];
27
+        $query = "UPDATE ".$this->table." SET ";
28
+        foreach($row as $key => $val){
29
+            $ar[':'.$key] = $val;
30
+            if($key == 'id') continue;
31
+            $query.= $this->qb->quote($key)." =:".$key.",";
32
+        }
33
+        $query = rtrim($query, ",");
34 34
 
35
-      return ['ar' => $ar, 'query' => $query];
35
+        return ['ar' => $ar, 'query' => $query];
36 36
     }
37 37
     public function createQuery($row){
38 38
         $ar = [];
Please login to merge, or discard this 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 = []){
25
+    public function buildQueryStrSingleFromArr($row = []) {
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/DeleteQueryBuilder.php 2 patches
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.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
      * @since v0.0.8
27 27
      */
28 28
     public function delete(
29
-      $table,
30
-      $where,
31
-      $whereRaw,
32
-      $whereIn,
33
-      $whereNotIn,
34
-      $whereNull,
35
-      $whereNotNull
29
+        $table,
30
+        $where,
31
+        $whereRaw,
32
+        $whereIn,
33
+        $whereNotIn,
34
+        $whereNull,
35
+        $whereNotNull
36 36
     ): bool
37 37
     {
38 38
         $wqb = new WhereQueryBuilder();
Please login to merge, or discard this patch.
src/Dolphin/Builders/WhereQueryBuilder.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
 
38 38
     private function whereAddedCondition($conditions = []){
39
-      return $this->whereAdded === false && count($conditions);
39
+        return $this->whereAdded === false && count($conditions);
40 40
     }
41 41
 
42 42
     public function buildWhereQuery($conditions = [])
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
         $firstTime = true;
50 50
         if ($this->whereAddedCondition($conditions)) {
51
-          $whereQuery[] = 'WHERE';
52
-          $this->whereAdded = true;
51
+            $whereQuery[] = 'WHERE';
52
+            $this->whereAdded = true;
53 53
         }
54 54
 
55 55
         foreach ($conditions as $where) {
Please login to merge, or discard this 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.
src/Dolphin/Builders/QueryBuilder.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -79,37 +79,37 @@
 block discarded – undo
79 79
     }
80 80
 
81 81
     private function buildLimitQuery($limit, $offset, $query = []){
82
-      $limitQuery = [];
83
-      if (!empty($limit)) {
84
-          $query[] = 'LIMIT';
82
+        $limitQuery = [];
83
+        if (!empty($limit)) {
84
+            $query[] = 'LIMIT';
85 85
 
86
-          if (!empty($offset)) {
87
-              $query[] = $offset.',';
88
-          }
86
+            if (!empty($offset)) {
87
+                $query[] = $offset.',';
88
+            }
89 89
 
90
-          $query[] = $limit;
91
-      }
90
+            $query[] = $limit;
91
+        }
92 92
 
93
-      if (count($limitQuery)) {
94
-          $query = array_merge($query, $limitQuery);
95
-      }
96
-      return $query;
93
+        if (count($limitQuery)) {
94
+            $query = array_merge($query, $limitQuery);
95
+        }
96
+        return $query;
97 97
     }
98 98
 
99 99
     public function query($query, $fetchRows){
100
-      try {
101
-          $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ);
102
-
103
-          if ($fetchRows == 'count') {
104
-              $obj = $obj->fetchColumn();
105
-          }
106
-
107
-          return $obj;
108
-      } catch (\PDOException $ex) {
109
-          throw new \PDOException($ex->getMessage(), 1);
110
-      } catch (Exception $e) {
111
-          throw new Exception($e->getMessage(), 1);
112
-      }
100
+        try {
101
+            $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ);
102
+
103
+            if ($fetchRows == 'count') {
104
+                $obj = $obj->fetchColumn();
105
+            }
106
+
107
+            return $obj;
108
+        } catch (\PDOException $ex) {
109
+            throw new \PDOException($ex->getMessage(), 1);
110
+        } catch (Exception $e) {
111
+            throw new Exception($e->getMessage(), 1);
112
+        }
113 113
     }
114 114
 
115 115
     public function buildQuery(array $params)
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         return "'".$field."'";
70 70
     }
71 71
 
72
-    private function getQueryFields($fields, $tbl){
72
+    private function getQueryFields($fields, $tbl) {
73 73
         $startQuery = join(', ', $fields);
74 74
         if (empty($fields)) {
75 75
             $startQuery = $this->quote($tbl).'.*';
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         return $startQuery;
79 79
     }
80 80
 
81
-    private function buildLimitQuery($limit, $offset, $query = []){
81
+    private function buildLimitQuery($limit, $offset, $query = []) {
82 82
       $limitQuery = [];
83 83
       if (!empty($limit)) {
84 84
           $query[] = 'LIMIT';
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
       return $query;
97 97
     }
98 98
 
99
-    public function query($query, $fetchRows){
99
+    public function query($query, $fetchRows) {
100 100
       try {
101 101
           $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ);
102 102
 
Please login to merge, or discard this patch.
src/Dolphin/Parsers/WhereQueryParser.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     {
33 33
         $ar = [];
34 34
         if(!count($whereQuery)){
35
-          return $ar;
35
+            return $ar;
36 36
         }
37 37
 
38 38
         foreach ($whereQuery as $where) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 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 = [];
18 18
         // expecting a string like 'status = :status'
19 19
         if ($this->checkWherePrepareUsed($bindKey)) {
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function parseWhereQuery($whereQuery = [])
32 32
     {
33 33
         $ar = [];
34
-        if(!count($whereQuery)){
34
+        if (!count($whereQuery)) {
35 35
           return $ar;
36 36
         }
37 37
 
Please login to merge, or discard this patch.
src/Dolphin/Builders/UpdateQueryBuilder.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@
 block discarded – undo
26 26
      * @since v0.0.8
27 27
      */
28 28
     public function update(
29
-      $row,
30
-      $table,
31
-      $where,
32
-      $whereRaw,
33
-      $whereIn,
34
-      $whereNotIn,
35
-      $whereNull,
36
-      $whereNotNull
29
+        $row,
30
+        $table,
31
+        $where,
32
+        $whereRaw,
33
+        $whereIn,
34
+        $whereNotIn,
35
+        $whereNull,
36
+        $whereNotNull
37 37
     ): bool
38 38
     {
39 39
         $wqb   = new WhereQueryBuilder();
Please login to merge, or discard this 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    = [];
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.