Passed
Pull Request — master (#7)
by Kris
02:47
created
lib/Query/Delete.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
      */
62 62
     public function where(): Where
63 63
     {
64
-        if (!isset($this->where)){
64
+        if (!isset($this->where)) {
65 65
             $this->where = new Query\Where($this, $this->driver);
66 66
         }
67 67
         return $this->where; 
Please login to merge, or discard this patch.
lib/Query/SelectBase.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $this->topQuery = $query;
117 117
 
118 118
         // columns arguments
119
-        if (! empty($args)) {
119
+        if (!empty($args)) {
120 120
             $this->parseColumnsArguments($args);
121 121
         }
122 122
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $cols = (count($args) === 1 && is_array($args[0])) ? $args[0] : $args;
136 136
 
137 137
         // parse column
138
-        foreach ($cols as $key => $value){
138
+        foreach ($cols as $key => $value) {
139 139
             
140 140
             // Each arg could be a non indexed array of name, or 
141 141
             // an indexed array name => alias
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      */
406 406
     public function where(): Where
407 407
     {
408
-        if (!isset($this->where)){
408
+        if (!isset($this->where)) {
409 409
             $this->where = new Query\Where($this, $this->driver, $this->topQuery);
410 410
         }
411 411
         return $this->where; 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      */
436 436
     public function having(): Having
437 437
     {
438
-        if (!isset($this->having)){
438
+        if (!isset($this->having)) {
439 439
             $this->having = new Query\Having($this, $this->driver, $this->topQuery);
440 440
         }
441 441
         return $this->having; 
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
      */
523 523
     public function limit($value)
524 524
     {
525
-        if (! is_null($value)) {
525
+        if (!is_null($value)) {
526 526
             $this->limit = (int) $value;
527 527
         }
528 528
         return $this;
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
      */
539 539
     public function offset($value)
540 540
     {
541
-        if (! is_null($value)) {
541
+        if (!is_null($value)) {
542 542
             $this->offset = (int) $value;
543 543
         }
544 544
         return $this;
Please login to merge, or discard this patch.
lib/Query/Select.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
     protected function getArgumentName(string $column): string
49 49
     {
50 50
         $topQuery = $this->topQuery ?: $this;  
51
-        $arg = ':_' . str_replace('.', '_', $column); 
52
-        return $topQuery->sqlParameterExists($arg) ? $arg . uniqid() : $arg;
51
+        $arg = ':_'.str_replace('.', '_', $column); 
52
+        return $topQuery->sqlParameterExists($arg) ? $arg.uniqid() : $arg;
53 53
     }
54 54
     
55 55
     /**
@@ -61,22 +61,22 @@  discard block
 block discarded – undo
61 61
     private function sqlColumns(): string
62 62
     {
63 63
         // no columns givens select all (SELECT *)
64
-        if (!count($this->columns) > 0 ) {
64
+        if (!count($this->columns) > 0) {
65 65
             return '*';   
66 66
         }
67 67
 
68 68
         // use DISTINCT ?
69
-        $sqlDistinct    = $this->distinct ? 'DISTINCT ': '';
69
+        $sqlDistinct = $this->distinct ? 'DISTINCT ' : '';
70 70
 
71 71
         // parse columns
72 72
         $colsList = array();
73
-        foreach ($this->columns as $val){
74
-            switch ($val['type']){
73
+        foreach ($this->columns as $val) {
74
+            switch ($val['type']) {
75 75
                    
76 76
                 // 'classic' column
77 77
                 case 'column':
78 78
                     $name       = $this->escape($val['name']);
79
-                    $alias      = isset($val['alias']) ? 'AS '. $this->escape($val['alias']) : '';
79
+                    $alias      = isset($val['alias']) ? 'AS '.$this->escape($val['alias']) : '';
80 80
                     $colsList[] = trim(sprintf('%s %s', $name, $alias));
81 81
                     break;  
82 82
                    
@@ -88,31 +88,31 @@  discard block
 block discarded – undo
88 88
                 // SUM() column
89 89
                 case 'sum':
90 90
                     $name       = $this->escape($val['name']);
91
-                    $alias      = isset($val['alias']) ? ' AS '. $this->escape($val['alias']) : '';
92
-                    $colsList[] = sprintf('SUM(%s)', $name) . $alias;
91
+                    $alias      = isset($val['alias']) ? ' AS '.$this->escape($val['alias']) : '';
92
+                    $colsList[] = sprintf('SUM(%s)', $name).$alias;
93 93
                     break;  
94 94
 
95 95
                 // MIN() column
96 96
                 case 'min':
97 97
                     $name       = $this->escape($val['name']);
98
-                    $alias      = isset($val['alias']) ? ' AS '. $this->escape($val['alias']) : '';
99
-                    $colsList[] = sprintf('MIN(%s)', $name) . $alias;
98
+                    $alias      = isset($val['alias']) ? ' AS '.$this->escape($val['alias']) : '';
99
+                    $colsList[] = sprintf('MIN(%s)', $name).$alias;
100 100
                     break;   
101 101
                     
102 102
                 // max() column
103 103
                 case 'max':
104 104
                     $name       = $this->escape($val['name']);
105
-                    $alias      = isset($val['alias']) ? ' AS '. $this->escape($val['alias']) : '';
106
-                    $colsList[] = sprintf('MAX(%s)', $name) . $alias;
105
+                    $alias      = isset($val['alias']) ? ' AS '.$this->escape($val['alias']) : '';
106
+                    $colsList[] = sprintf('MAX(%s)', $name).$alias;
107 107
                     break;        
108 108
 
109 109
                 // sub query
110 110
                 case 'sub_query':
111
-                    $colsList[] = '('. $val['query']->sql() .') AS '. $this->escape($val['alias']);
111
+                    $colsList[] = '('.$val['query']->sql().') AS '.$this->escape($val['alias']);
112 112
                     break;
113 113
            }
114 114
         }
115
-        return $sqlDistinct . implode(', ', $colsList);
115
+        return $sqlDistinct.implode(', ', $colsList);
116 116
     }
117 117
     
118 118
     /**
@@ -124,26 +124,26 @@  discard block
 block discarded – undo
124 124
     public function sql(): string
125 125
     {
126 126
         $topQuery = $this->topQuery ?: $this;  
127
-        $sqlJoins = empty($this->joins) ? '' : implode(' ', $this->joins) ; 
128
-        $sqlFromTable =  'FROM '. $this->escape($this->fromTable);
127
+        $sqlJoins = empty($this->joins) ? '' : implode(' ', $this->joins); 
128
+        $sqlFromTable = 'FROM '.$this->escape($this->fromTable);
129 129
         $sqlWhere = isset($this->where) ? $this->where->sql() : '';
130 130
         $sqlGroupBy = empty($this->groupBy) ? '' : 'GROUP BY '.implode(', ', $this->escapeList($this->groupBy));
131 131
         $sqlHaving = isset($this->having) ? $this->having->sql() : '';
132 132
 
133 133
         // order by
134 134
         $sqlOrderBy = '';
135
-        if (! empty($this->orderBy)){
135
+        if (!empty($this->orderBy)) {
136 136
             $sortArgs = [];
137
-            foreach ($this->orderBy as $item){
138
-                $sql = $item['column'] ? $this->escape($item['column']) . ' ' : '';
139
-                $sortArgs[] = $sql . $item['order'];
137
+            foreach ($this->orderBy as $item) {
138
+                $sql = $item['column'] ? $this->escape($item['column']).' ' : '';
139
+                $sortArgs[] = $sql.$item['order'];
140 140
             }
141
-            $sqlOrderBy = 'ORDER BY ' . implode(', ', $sortArgs);
141
+            $sqlOrderBy = 'ORDER BY '.implode(', ', $sortArgs);
142 142
         }
143 143
 
144 144
         // limit
145 145
         $sqlLimit = '';
146
-        if ($this->limit > 0){
146
+        if ($this->limit > 0) {
147 147
             $argName = $this->getArgumentName('LIMIT');   
148 148
             $topQuery->setSqlParameter($argName, $this->limit); 
149 149
             $sqlLimit = 'LIMIT '.$argName;
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 
152 152
         // offset
153 153
         $sqlOffset = '';
154
-        if ($this->offset > 0){
154
+        if ($this->offset > 0) {
155 155
             $argName = $this->getArgumentName('OFFSET');   
156 156
             $topQuery->setSqlParameter($argName, $this->offset); 
157
-            $sqlOffset = 'OFFSET ' . $argName;
157
+            $sqlOffset = 'OFFSET '.$argName;
158 158
         }
159 159
 
160 160
         return trim(implode(' ', ['SELECT', 
Please login to merge, or discard this patch.
lib/Query/Update.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $columns = array();
60 60
         foreach ($this->parameters as $key => $val) {
61
-            $arg       = ':_' . str_replace('.', '_', $key); 
62
-            $columns[] = $this->escape($key) . ' =' .$arg; 
61
+            $arg       = ':_'.str_replace('.', '_', $key); 
62
+            $columns[] = $this->escape($key).' ='.$arg; 
63 63
             $this->pdoParameters[$arg] = $val; 
64 64
         }
65 65
         foreach ($this->incrementColumns as $key => $val) {
66
-            $columns[] = $this->escape($key) . ' =' . $this->escape($key) . '+' .$val ; 
66
+            $columns[] = $this->escape($key).' ='.$this->escape($key).'+'.$val; 
67 67
         }
68 68
         foreach ($this->decrementColumns as $key => $val) {
69
-            $columns[] = $this->escape($key) . ' =' . $this->escape($key) . '-' .$val ; 
69
+            $columns[] = $this->escape($key).' ='.$this->escape($key).'-'.$val; 
70 70
         }
71 71
         return implode(', ', $columns);
72 72
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function where(): Where
81 81
     {
82
-        if (!isset($this->where)){
82
+        if (!isset($this->where)) {
83 83
             $this->where = new Query\Where($this, $this->driver);
84 84
         }
85 85
         return $this->where; 
Please login to merge, or discard this patch.
lib/Query/Where.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public function in(string $column, array $values)
166 166
     {
167
-        if (! empty($values)) {
167
+        if (!empty($values)) {
168 168
             $this->addCondition('IN', $this->query->escape($column).' IN ', $column, $values);
169 169
         }
170 170
         return $this->returnFunction();
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function notIn(string $column, array $values)
183 183
     {
184
-        if (! empty($values)) {
184
+        if (!empty($values)) {
185 185
             $this->addCondition('NOT_IN', $this->query->escape($column).' NOT IN ', $column, $values);
186 186
         }
187 187
         return $this->returnFunction();
Please login to merge, or discard this patch.
lib/Query/QueryBuilder.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             }
204 204
 
205 205
             // register error 
206
-            $this->error['code'] = (int)$e->getCode();
206
+            $this->error['code'] = (int) $e->getCode();
207 207
             $this->error['message'] = $e->getMessage();
208 208
             return false;
209 209
         }
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
                 $paramType = \PDO::PARAM_STR; // default
228 228
 
229 229
                 if (!isset($val)) {
230
-                    $paramType =  \PDO::PARAM_NULL;
230
+                    $paramType = \PDO::PARAM_NULL;
231 231
                 
232 232
                 } elseif (is_int($val)) {
233
-                    $paramType =  \PDO::PARAM_INT;
233
+                    $paramType = \PDO::PARAM_INT;
234 234
                 
235 235
                 } elseif (is_bool($val)) {
236
-                    $paramType =  \PDO::PARAM_BOOL;
236
+                    $paramType = \PDO::PARAM_BOOL;
237 237
                 } 
238 238
                 
239 239
                 // bind value
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
     {
253 253
         try {
254 254
             // prepare bind execute
255
-            if (!isset($this->pdoStatement)){
256
-               if (!$this->prepare()){
255
+            if (!isset($this->pdoStatement)) {
256
+               if (!$this->prepare()) {
257 257
                    return false;
258 258
                }
259 259
             }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             }
269 269
 
270 270
             // register error 
271
-            $this->error['code'] = (int)$e->getCode();
271
+            $this->error['code'] = (int) $e->getCode();
272 272
             $this->error['message'] = $e->getMessage();
273 273
             return false;
274 274
         }
@@ -296,23 +296,23 @@  discard block
 block discarded – undo
296 296
      */
297 297
     protected function fetchOutput(bool $executed, string $outputFormat)
298 298
     {
299
-        switch (strtoupper($outputFormat)){
299
+        switch (strtoupper($outputFormat)) {
300 300
 
301 301
             case Output::ASSOC:    
302
-                return $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_ASSOC) :  array();
302
+                return $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_ASSOC) : array();
303 303
 
304 304
             case Output::OBJ:    
305
-                return $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_OBJ) :    array();
305
+                return $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_OBJ) : array();
306 306
 
307 307
             case Output::COLUMN:    
308
-                return $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_COLUMN) :  array();
308
+                return $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_COLUMN) : array();
309 309
 
310 310
             case Output::JSON:
311
-                $results = $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_ASSOC) :  array();
311
+                $results = $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_ASSOC) : array();
312 312
                 return json_encode($results, JSON_NUMERIC_CHECK);   
313 313
 
314 314
             case Output::JSON_PRETTY_PRINT:    
315
-                $results = $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_ASSOC) :  array();
315
+                $results = $executed ? $this->pdoStatement->fetchAll(\PDO::FETCH_ASSOC) : array();
316 316
                 return json_encode($results, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);   
317 317
                 
318 318
             default:
Please login to merge, or discard this patch.
lib/Query/QueryFilter.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
      */
113 113
     private function getArgumentName(string $column): string
114 114
     {
115
-        $arg = ':__' . str_replace('.', '_', $column); 
116
-        return $this->topQuery->sqlParameterExists($arg) ? $arg . uniqid() : $arg;
115
+        $arg = ':__'.str_replace('.', '_', $column); 
116
+        return $this->topQuery->sqlParameterExists($arg) ? $arg.uniqid() : $arg;
117 117
     }
118 118
 
119 119
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     {
216 216
         // define argument for each values
217 217
         $valueArgs = array();
218
-        foreach($item['value'] as $value){
218
+        foreach ($item['value'] as $value) {
219 219
             $arg = $this->getArgumentName($item['column']); 
220 220
             $valueArgs[] = $arg;
221 221
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         }
225 225
         
226 226
         //build and return sql
227
-        return $item['sql']. '(' . implode(', ', $valueArgs) .')';
227
+        return $item['sql'].'('.implode(', ', $valueArgs).')';
228 228
     }
229 229
 
230 230
     /**
@@ -237,20 +237,20 @@  discard block
 block discarded – undo
237 237
     {
238 238
         $sql = '';
239 239
         if (!empty($this->conditions)) {
240
-            $sql = ' '. $this->sqlBase  .' ';  // start the SQL WHERE or HAVING clause
241
-            $currentOperator = 'AND';          // current condition operator
240
+            $sql = ' '.$this->sqlBase.' '; // start the SQL WHERE or HAVING clause
241
+            $currentOperator = 'AND'; // current condition operator
242 242
             
243 243
             foreach ($this->conditions as $key => $item) {
244 244
 
245 245
                 // need operator AND or OR, except for the first or if 
246 246
                 // previous item is a begin group item
247
-                $isSqlNeedOperator = $key > 0  && $this->conditions[$key -1]['type'] != 'group_start';
247
+                $isSqlNeedOperator = $key > 0 && $this->conditions[$key-1]['type'] != 'group_start';
248 248
 
249 249
                 switch ($item['type']) {
250 250
                     
251 251
                     case'group_start':
252 252
                         $currentOperator = $item['operator']; // register operator
253
-                        $sql .= '(' ;
253
+                        $sql .= '(';
254 254
                         break;
255 255
                     
256 256
                     case'group_end':
@@ -260,32 +260,32 @@  discard block
 block discarded – undo
260 260
 
261 261
                    case 'NULL':
262 262
                    case 'NOT_NULL':
263
-                        $sql .=  $isSqlNeedOperator ? ' '.$currentOperator.' ' : '';
264
-                        $sql .=  $item['sql'];
263
+                        $sql .= $isSqlNeedOperator ? ' '.$currentOperator.' ' : '';
264
+                        $sql .= $item['sql'];
265 265
                         break;
266 266
 
267 267
                     case 'IN':
268 268
                     case 'NOT_IN':
269
-                        $sql .=  $isSqlNeedOperator ? ' '.$currentOperator.' ' : '';
270
-                        $sql .=  $this->getSqlInOrNotIn($item);
269
+                        $sql .= $isSqlNeedOperator ? ' '.$currentOperator.' ' : '';
270
+                        $sql .= $this->getSqlInOrNotIn($item);
271 271
                         break;
272 272
 
273 273
                     default:
274 274
                         // support for column literral 
275 275
                         if (is_string($item['value']) && 
276
-                            strlen($item['value']) >  strlen(Patabase\Constants::COLUMN_LITERALL) &&
276
+                            strlen($item['value']) > strlen(Patabase\Constants::COLUMN_LITERALL) &&
277 277
                             substr($item['value'], 0, strlen(Patabase\Constants::COLUMN_LITERALL)) === 
278 278
                                                              Patabase\Constants::COLUMN_LITERALL) {
279 279
 
280 280
                             $arg = substr($item['value'], strlen(Patabase\Constants::COLUMN_LITERALL));
281
-                            $sql .=  $isSqlNeedOperator ? ' '.$currentOperator.' ' : '';
282
-                            $sql .=  $item['sql'] . $this->query->escape($arg);
281
+                            $sql .= $isSqlNeedOperator ? ' '.$currentOperator.' ' : '';
282
+                            $sql .= $item['sql'].$this->query->escape($arg);
283 283
 
284
-                        }   else {
284
+                        } else {
285 285
                                 // *normal* value 
286 286
                                 $arg = $this->getArgumentName($item['column']);
287
-                                $sql .=  $isSqlNeedOperator ? ' '.$currentOperator.' ' : '';
288
-                                $sql .=  $item['sql'] . $arg;
287
+                                $sql .= $isSqlNeedOperator ? ' '.$currentOperator.' ' : '';
288
+                                $sql .= $item['sql'].$arg;
289 289
                                
290 290
                                 // set parameters
291 291
                                 $this->topQuery->setSqlParameter($arg, $item['value']); 
Please login to merge, or discard this patch.
lib/Query/CreateTable.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -142,50 +142,50 @@  discard block
 block discarded – undo
142 142
     private function sqlColumns(): string
143 143
     {
144 144
         $result = array();
145
-        foreach ($this->columns as $col){
145
+        foreach ($this->columns as $col) {
146 146
 
147 147
             // Parse arguments. First item is NAME and second is TYPE
148 148
             $sqlName   = $this->escape($col[0]);
149
-            $sqlType   = $col[1];  //TODO check type
149
+            $sqlType   = $col[1]; //TODO check type
150 150
             
151 151
             // following arguments
152
-            $args       = array_slice($col, 2);
152
+            $args = array_slice($col, 2);
153 153
             $currentIndex       = 0;
154 154
             $defaultValueIndex  = -1;
155 155
 
156
-            $sqlConstraintUnique    = '';       // UNIQUE ?, not by default
157
-            $sqlConstraintNullable  = 'NULL';   // allow null value by default
158
-            $isPk                   = false;    // PRIMARY KEY?
159
-            $sqlDefault             = '';       // DEFAULT VALUE?
156
+            $sqlConstraintUnique    = ''; // UNIQUE ?, not by default
157
+            $sqlConstraintNullable  = 'NULL'; // allow null value by default
158
+            $isPk                   = false; // PRIMARY KEY?
159
+            $sqlDefault             = ''; // DEFAULT VALUE?
160 160
 
161
-            foreach ($args as $arg){
161
+            foreach ($args as $arg) {
162 162
 
163 163
                 // last index was DEFAULT, so the current argument 
164 164
                 // is the value for default contsaint
165
-                if ($currentIndex === $defaultValueIndex){
165
+                if ($currentIndex === $defaultValueIndex) {
166 166
                     
167 167
                     // string
168
-                    if (is_string($arg)){
168
+                    if (is_string($arg)) {
169 169
                             
170 170
                         // escape everything except constants
171
-                        if (in_array(strtoupper($arg), $this->supportedDefaults)){
172
-                            $sqlDefault = 'DEFAULT ' . $arg;
171
+                        if (in_array(strtoupper($arg), $this->supportedDefaults)) {
172
+                            $sqlDefault = 'DEFAULT '.$arg;
173 173
                         } else {
174
-                            $sqlDefault = 'DEFAULT ' . $this->driver->escapeValue($arg);
174
+                            $sqlDefault = 'DEFAULT '.$this->driver->escapeValue($arg);
175 175
                         }
176 176
                         
177 177
                     // int/float are not escaped
178
-                    } elseif (is_int($arg) || is_float($arg)){
179
-                        $sqlDefault = 'DEFAULT ' . $arg;
178
+                    } elseif (is_int($arg) || is_float($arg)) {
179
+                        $sqlDefault = 'DEFAULT '.$arg;
180 180
 
181 181
                     // bool Type
182
-                    } elseif (is_bool($arg)){
183
-                        $sqlDefault = 'DEFAULT ' . ($arg ? 'TRUE' : 'FALSE');                            
182
+                    } elseif (is_bool($arg)) {
183
+                        $sqlDefault = 'DEFAULT '.($arg ? 'TRUE' : 'FALSE');                            
184 184
                     }
185 185
 
186 186
 
187 187
                 } else {
188
-                    switch (strtoupper($arg)){
188
+                    switch (strtoupper($arg)) {
189 189
                         
190 190
                         // NULL  /NOT NULL 
191 191
                         case 'NULL':
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
                         // DEFAULT
220 220
                         case 'DEFAULT':
221 221
                             // define next index as the DefaultValue index
222
-                            $defaultValueIndex = $currentIndex +1;
222
+                            $defaultValueIndex = $currentIndex+1;
223 223
                             break;
224 224
                     
225 225
                     }
226 226
                 }
227 227
 
228 228
                 // update  current index
229
-                $currentIndex ++;
229
+                $currentIndex++;
230 230
             }
231 231
 
232 232
             // set optional params
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
         }
242 242
 
243 243
         // FK CONSTRANT
244
-        foreach ($this->foreignKeys as $foreignKey){
245
-            $result[] =  trim(sprintf('CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s(%s)', 
244
+        foreach ($this->foreignKeys as $foreignKey) {
245
+            $result[] = trim(sprintf('CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s(%s)', 
246 246
                             $foreignKey['name'], 
247 247
                             $this->driver->escapeIdentifier($foreignKey['src_column']), 
248 248
                             $this->driver->escapeIdentifier($foreignKey['ref_table']),
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     public function sql(): string
263 263
     {
264 264
         $sqlTableName = $this->driver->escape($this->tableName);
265
-        $sqlIfNotExists =  $this->isNotExists === true ? 'IF NOT EXISTS' : '';
265
+        $sqlIfNotExists = $this->isNotExists === true ? 'IF NOT EXISTS' : '';
266 266
 
267 267
         return trim(sprintf(
268 268
             'CREATE TABLE %s %s (%s) %s',
Please login to merge, or discard this patch.
lib/Table.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $query = new Query\Update($this->database->getDriver(), $this->name);
96 96
         foreach ($parameters as $key => $val) {
97
-            $query->setValue($key,  $val);
97
+            $query->setValue($key, $val);
98 98
         }
99 99
         return $query;
100 100
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $query = new Query\Insert($this->database->getDriver(), $this->name);
124 124
         foreach ($parameters as $key => $val) {
125
-            $query->setValue($key,  $val);
125
+            $query->setValue($key, $val);
126 126
         }
127 127
         return $query;
128 128
     }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     public function rename(string $newName): bool
172 172
     {
173 173
        $result = $this->database->renameTable($this->name, $newName);
174
-       if ($result){
174
+       if ($result) {
175 175
             $this->name = $newName;
176 176
         }
177 177
         return $result;
Please login to merge, or discard this patch.