Completed
Push — master ( 274d98...aefd8c )
by Ahmet
01:43
created
src/qb.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
             switch ($this->_write_field_types[$d]) {
239 239
             case 0:
240 240
               $t .= "'".$this->_write_values[$d]."'";
241
-              break;
242
-          default:
241
+                break;
242
+            default:
243 243
               $t .= $this->_write_values[$d];
244
-          }
244
+            }
245 245
             $updates[] = $t;
246 246
         }
247 247
         $update_fields = implode(', ', $updates);
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
             switch ($this->_write_field_types[$d]) {
271 271
             case 0:
272 272
               $values[] = "'".$this->_write_values[$d]."'";
273
-              break;
273
+                break;
274 274
             default:
275 275
               $values[] = $this->_write_values[$d];
276
-          }
276
+            }
277 277
         }
278 278
         $string = sprintf('insert into %1$s (%2$s) values(%3$s)', $table, $fields, implode(', ', $values));
279 279
 
Please login to merge, or discard this patch.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -309,18 +309,18 @@
 block discarded – undo
309 309
             throw new \Exception('Specify at least 1 table name');
310 310
         }
311 311
         switch ($join_type) {
312
-                case qb::INNER_JOIN:
313
-                    $join_type_ = 'INNER JOIN';
314
-                    break;
315
-                case qb::LEFT_JOIN:
316
-                    $join_type_ = 'LEFT JOIN';
317
-                    break;
318
-                case qb::RIGHT_JOIN:
319
-                    $join_type_ = 'RIGHT JOIN';
320
-                    break;
321
-                case qb::FULL_JOIN:
322
-                    $join_type_ = 'FULL OUTER JOIN';
323
-                    break;
312
+        case qb::INNER_JOIN:
313
+            $join_type_ = 'INNER JOIN';
314
+            break;
315
+        case qb::LEFT_JOIN:
316
+            $join_type_ = 'LEFT JOIN';
317
+            break;
318
+        case qb::RIGHT_JOIN:
319
+            $join_type_ = 'RIGHT JOIN';
320
+            break;
321
+        case qb::FULL_JOIN:
322
+            $join_type_ = 'FULL OUTER JOIN';
323
+            break;
324 324
             }
325 325
         $table = $this->_table_names[0];
326 326
         $where = count($this->_conditions) > 0 ? (' on ' . implode(' and ', $this->_conditions)) : null;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function whereOr()
105 105
     {
106
-        $this->_conditions[] = '('.implode(' or ', func_get_args()).')';
106
+        $this->_conditions[] = '(' . implode(' or ', func_get_args()) . ')';
107 107
 
108 108
         return $this;
109 109
     }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         //
183 183
         $limit = null;
184 184
         if ($this->limit > 0) {
185
-            $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit;
185
+            $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit;
186 186
         }
187 187
 
188 188
         //
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         //
191 191
         $group = null;
192 192
         if (count($this->_group_fields) > 0) {
193
-            $group = ' group by '.implode(', ', $this->_group_fields).' ';
193
+            $group = ' group by ' . implode(', ', $this->_group_fields) . ' ';
194 194
         }
195 195
 
196 196
         //
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
                     $pos = strpos($of[0], '.');
207 207
                     if ($pos !== false) {
208 208
                         $t = explode('.', $of[0]);
209
-                        $t[1] = '`'.$t[1].'`';
209
+                        $t[1] = '`' . $t[1] . '`';
210 210
                         $of[0] = implode('.', $t);
211 211
                         $order .= $of[0];
212 212
                     } else {
213
-                        $order .= '`'.$of[0].'`';
213
+                        $order .= '`' . $of[0] . '`';
214 214
                     }
215
-                    $order .= ' '.($of[1] ? 'asc' : 'desc');
215
+                    $order .= ' ' . ($of[1] ? 'asc' : 'desc');
216 216
                 } else {
217 217
                     $order .= $of[0];
218 218
                 }
219 219
                 ++$i;
220 220
             }
221 221
         }
222
-        $string = sprintf('select %1$s from %2$s%7$s%3$s%6$s%4$s%5$s', implode(', ', $_read_fields), implode(', ', $this->_table_names), count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null, $order, $limit, $group, $joins);
222
+        $string = sprintf('select %1$s from %2$s%7$s%3$s%6$s%4$s%5$s', implode(', ', $_read_fields), implode(', ', $this->_table_names), count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null, $order, $limit, $group, $joins);
223 223
 
224 224
         return $string;
225 225
     }
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
         }
235 235
         $updates = array();
236 236
         for ($d = 0, $m = count($this->_write_fields); $d < $m; ++$d) {
237
-            $t = '`' . $this->_write_fields[$d].'`=';
237
+            $t = '`' . $this->_write_fields[$d] . '`=';
238 238
             switch ($this->_write_field_types[$d]) {
239 239
             case 0:
240
-              $t .= "'".$this->_write_values[$d]."'";
240
+              $t .= "'" . $this->_write_values[$d] . "'";
241 241
               break;
242 242
           default:
243 243
               $t .= $this->_write_values[$d];
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
         $update_fields = implode(', ', $updates);
248 248
         $limit = null;
249 249
         if ($this->limit > 0) {
250
-            $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit;
250
+            $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit;
251 251
         }
252
-        $where = count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null;
252
+        $where = count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null;
253 253
         $string = sprintf('update %1$s set %2$s %3$s %4$s', $this->_table_names[0], $update_fields, $where, $limit);
254 254
 
255 255
         return $string;
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
             throw new \Exception('Specify at least 1 write field (set function)');
265 265
         }
266 266
         $table = $this->_table_names[0];
267
-        $fields = '`'.implode('`, `', $this->_write_fields).'`';
267
+        $fields = '`' . implode('`, `', $this->_write_fields) . '`';
268 268
         $values = array();
269 269
         for ($d = 0, $m = count($this->_write_fields); $d < $m; ++$d) {
270 270
             switch ($this->_write_field_types[$d]) {
271 271
             case 0:
272
-              $values[] = "'".$this->_write_values[$d]."'";
272
+              $values[] = "'" . $this->_write_values[$d] . "'";
273 273
               break;
274 274
             default:
275 275
               $values[] = $this->_write_values[$d];
@@ -286,10 +286,10 @@  discard block
 block discarded – undo
286 286
             throw new \Exception('Specify at least 1 table name');
287 287
         }
288 288
         $table = $this->_table_names[0];
289
-        $where = count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null;
289
+        $where = count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null;
290 290
         $limit = null;
291 291
         if ($this->limit > 0) {
292
-            $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit;
292
+            $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit;
293 293
         }
294 294
         $string = sprintf('delete from %1$s %2$s %3$s', $table, $where, $limit);
295 295
 
Please login to merge, or discard this patch.