Passed
Pull Request — master (#2)
by Maksim
02:00
created
src/QueryBuilder.php 2 patches
Braces   +60 added lines, -30 removed lines patch added patch discarded remove patch
@@ -182,7 +182,8 @@  discard block
 block discarded – undo
182 182
         $types = [static::TYPE_INSERT, static::TYPE_UPDATE, static::TYPE_DELETE, static::TYPE_SELECT];
183 183
         if (in_array($type, $types, true)) {
184 184
             $this->_type = $type;
185
-        } else {
185
+        }
186
+        else {
186 187
             throw new QBException('Incorrect type');
187 188
         }
188 189
 
@@ -255,12 +256,15 @@  discard block
 block discarded – undo
255 256
         if ($newSelect === false) {
256 257
             if ($tableAlias === null || $rawColumn === '*') {
257 258
                 $columns = $rawColumn;
258
-            } elseif (strpos($rawColumn, '.') !== false) {
259
+            }
260
+            elseif (strpos($rawColumn, '.') !== false) {
259 261
                 $columns = $rawColumn;
260
-            } else {
262
+            }
263
+            else {
261 264
                 $columns = $tableAlias . '.' . $rawColumn;
262 265
             }
263
-        } else {
266
+        }
267
+        else {
264 268
             list($alias, $joinColumn) = $newSelect;
265 269
             $columns = $alias . '.' . $joinColumn;
266 270
         }
@@ -286,17 +290,21 @@  discard block
 block discarded – undo
286 290
             foreach ($this->_select as $alias => $column) {
287 291
                 if ($column instanceof Aggregation) {
288 292
                     $select[$alias] = $this->buildSelectFromAggregation($column);
289
-                } else if (is_string($column)) {
293
+                }
294
+                else if (is_string($column)) {
290 295
                     if (strpos($column, 'SELECT') !== false) {
291 296
                         $select[$alias] = $column;
292
-                    } else {
297
+                    }
298
+                    else {
293 299
                         $select[$alias] = $this->addColumnAlias($builder->fetchColumnName($column));
294 300
                     }
295
-                } else {
301
+                }
302
+                else {
296 303
                     $select[$alias] = $column;
297 304
                 }
298 305
             }
299
-        } else if (is_string($this->_select)) {
306
+        }
307
+        else if (is_string($this->_select)) {
300 308
             $select = $this->addColumnAlias($this->_select);
301 309
         }
302 310
         return $this->getAdapter()->sqlSelect($select, $this->_queryOptions);
@@ -316,7 +324,8 @@  discard block
 block discarded – undo
316 324
 
317 325
         if ($alias) {
318 326
             $this->_select[$alias] = $select;
319
-        } else {
327
+        }
328
+        else {
320 329
             $this->_select[] = $select;
321 330
         }
322 331
 
@@ -333,7 +342,8 @@  discard block
 block discarded – undo
333 342
         if (is_string($select) && $newSelect = $this->getLookupBuilder()->buildJoin($this, $select)) {
334 343
             list($t_alias, $column) = $newSelect;
335 344
             $this->pushToSelect($t_alias . '.' . $column, $alias);
336
-        } else {
345
+        }
346
+        else {
337 347
             $this->pushToSelect(
338 348
                 $this->hydrate($select),
339 349
                 $alias
@@ -359,7 +369,8 @@  discard block
 block discarded – undo
359 369
             foreach ($select as $key => $part) {
360 370
                 $this->addSelect($part, $key);
361 371
             }
362
-        } else {
372
+        }
373
+        else {
363 374
             $this->addSelect($select);
364 375
         }
365 376
 
@@ -473,10 +484,12 @@  discard block
 block discarded – undo
473 484
     {
474 485
         if ($tableName instanceof QueryBuilderInterface) {
475 486
             $this->_join[] = $this->getAdapter()->sqlJoin($joinType, $tableName, $on, $alias, $index);
476
-        } else {
487
+        }
488
+        else {
477 489
             if ($joinType === 'RAW' && !empty($tableName)) {
478 490
                 $join = $this->getAdapter()->quoteSql($tableName);
479
-            } else {
491
+            }
492
+            else {
480 493
                 $join = $this->getAdapter()->sqlJoin($joinType, $tableName, $on, $alias);
481 494
             }
482 495
 
@@ -548,7 +561,8 @@  discard block
 block discarded – undo
548 561
             foreach ($columns as $column) {
549 562
                 $this->addOrder($column);
550 563
             }
551
-        } else {
564
+        }
565
+        else {
552 566
             $this->addOrder($columns);
553 567
         }
554 568
 
@@ -582,11 +596,13 @@  discard block
 block discarded – undo
582 596
                     }
583 597
 
584 598
                     $this->_order[] = $_column;
585
-                } else {
599
+                }
600
+                else {
586 601
                     $this->_order[] = current($temp);
587 602
                 }
588 603
             }
589
-        } else {
604
+        }
605
+        else {
590 606
             $this->_order[] = $column;
591 607
         }
592 608
 
@@ -675,14 +691,18 @@  discard block
 block discarded – undo
675 691
                 if (is_numeric($key)) {
676 692
                     if ($value instanceof IToSql) {
677 693
                         $parts[] = $this->parseCondition($value, $operator);
678
-                    } elseif ($value instanceof QueryBuilder) {
694
+                    }
695
+                    elseif ($value instanceof QueryBuilder) {
679 696
                         $parts[] = $this->parseCondition($value, $operator);
680
-                    } else if (is_array($value)) {
697
+                    }
698
+                    else if (is_array($value)) {
681 699
                         $parts[] = $this->parseCondition($value, $operator);
682
-                    } else if (is_string($value)) {
700
+                    }
701
+                    else if (is_string($value)) {
683 702
                         $parts[] = $value;
684 703
                     }
685
-                } else {
704
+                }
705
+                else {
686 706
                     $tableAlias = $this->getAlias();
687 707
                     $value = $this->getAdapter()->prepareValue($value);
688 708
 
@@ -703,13 +723,16 @@  discard block
 block discarded – undo
703 723
                 return '(' . implode(') ' . $operator . ' (', $parts) . ')';
704 724
             }
705 725
 
706
-        } else if ($condition instanceof IToSql) {
726
+        }
727
+        else if ($condition instanceof IToSql) {
707 728
             return $condition
708 729
                 ->setQb($this)
709 730
                 ->toSql();
710
-        } else if ($condition instanceof QueryBuilder) {
731
+        }
732
+        else if ($condition instanceof QueryBuilder) {
711 733
             return $condition->toSQL();
712
-        } else if (is_string($condition)) {
734
+        }
735
+        else if (is_string($condition)) {
713 736
             return $condition;
714 737
         }
715 738
 
@@ -722,7 +745,8 @@  discard block
 block discarded – undo
722 745
         foreach ($operands as $operand) {
723 746
             if (is_array($operand)) {
724 747
                 $operand = $this->buildCondition($operand, $params);
725
-            } else {
748
+            }
749
+            else {
726 750
                 $operand = $this->parseCondition($operand);
727 751
             }
728 752
             if ($operand !== '') {
@@ -783,7 +807,8 @@  discard block
 block discarded – undo
783 807
         foreach ($this->_whereAnd as $condition) {
784 808
             if (empty($where)) {
785 809
                 $where = ['and', $condition];
786
-            } else {
810
+            }
811
+            else {
787 812
                 $where = ['and', $where, ['and', $condition]];
788 813
             }
789 814
         }
@@ -791,7 +816,8 @@  discard block
 block discarded – undo
791 816
         foreach ($this->_whereOr as $condition) {
792 817
             if (empty($where)) {
793 818
                 $where = ['or', $condition];
794
-            } else {
819
+            }
820
+            else {
795 821
                 $where = ['or', $where, ['and', $condition]];
796 822
             }
797 823
         }
@@ -1116,7 +1142,8 @@  discard block
 block discarded – undo
1116 1142
     {
1117 1143
         if (strpos($order, '-') === false) {
1118 1144
             $direction = 'ASC';
1119
-        } else {
1145
+        }
1146
+        else {
1120 1147
             $direction = 'DESC';
1121 1148
             $order = substr($order, 1);
1122 1149
         }
@@ -1153,12 +1180,14 @@  discard block
 block discarded – undo
1153 1180
                 }
1154 1181
                 else if ($column === '?') {
1155 1182
                     $order[] = $this->getAdapter()->getRandomOrder();
1156
-                } else {
1183
+                }
1184
+                else {
1157 1185
                     list($newColumn, $direction) = $this->buildOrderJoin($column);
1158 1186
                     $order[$this->applyTableAlias($newColumn)] = $direction;
1159 1187
                 }
1160 1188
             }
1161
-        } else {
1189
+        }
1190
+        else {
1162 1191
             $order[] = $this->buildOrderJoin($this->_order);
1163 1192
         }
1164 1193
 
@@ -1205,7 +1234,8 @@  discard block
 block discarded – undo
1205 1234
     {
1206 1235
         if ($this->_alias !== null && !is_array($this->_from)) {
1207 1236
             $from = [$this->_alias => $this->_from];
1208
-        } else {
1237
+        }
1238
+        else {
1209 1239
             $from = $this->_from;
1210 1240
         }
1211 1241
         $sql = $this->getAdapter()->sqlFrom($from);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 
844 844
     protected function generateDeleteSql()
845 845
     {
846
-        $options = $this->_queryOptions ;
846
+        $options = $this->_queryOptions;
847 847
         if ($options) {
848 848
             $options = " {$options} ";
849 849
         }
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
         $tableName = $this->getAdapter()->getRawTableName($table);
980 980
 
981 981
         if (strpos($tableName, '.') !== false) {
982
-            $tableName = substr($tableName, strpos($tableName, '.')+1);
982
+            $tableName = substr($tableName, strpos($tableName, '.') + 1);
983 983
         }
984 984
 
985 985
         return strtr('{table}_{count}', [
Please login to merge, or discard this patch.