Passed
Push — master ( 3ed246...04b8fa )
by Maksim
07:23
created
src/QueryBuilder.php 1 patch
Braces   +62 added lines, -31 removed lines patch added patch discarded remove patch
@@ -189,7 +189,8 @@  discard block
 block discarded – undo
189 189
         $types = [static::TYPE_INSERT, static::TYPE_UPDATE, static::TYPE_DELETE, static::TYPE_SELECT];
190 190
         if (in_array($type, $types, true)) {
191 191
             $this->_type = $type;
192
-        } else {
192
+        }
193
+        else {
193 194
             throw new QBException('Incorrect type');
194 195
         }
195 196
 
@@ -261,12 +262,15 @@  discard block
 block discarded – undo
261 262
         if ($newSelect === false) {
262 263
             if ($tableAlias === null || $rawColumn === '*') {
263 264
                 $columns = $rawColumn;
264
-            } elseif (strpos($rawColumn, '.') !== false) {
265
+            }
266
+            elseif (strpos($rawColumn, '.') !== false) {
265 267
                 $columns = $rawColumn;
266
-            } else {
268
+            }
269
+            else {
267 270
                 $columns = $tableAlias . '.' . $rawColumn;
268 271
             }
269
-        } else {
272
+        }
273
+        else {
270 274
             list($alias, $joinColumn) = $newSelect;
271 275
             $columns = $alias . '.' . $joinColumn;
272 276
         }
@@ -292,17 +296,21 @@  discard block
 block discarded – undo
292 296
             foreach ($this->_select as $alias => $column) {
293 297
                 if ($column instanceof Aggregation) {
294 298
                     $select[$alias] = $this->buildSelectFromAggregation($column);
295
-                } else if (is_string($column)) {
299
+                }
300
+                else if (is_string($column)) {
296 301
                     if (strpos($column, 'SELECT') !== false) {
297 302
                         $select[$alias] = $column;
298
-                    } else {
303
+                    }
304
+                    else {
299 305
                         $select[$alias] = $this->addColumnAlias($builder->fetchColumnName($column));
300 306
                     }
301
-                } else {
307
+                }
308
+                else {
302 309
                     $select[$alias] = $column;
303 310
                 }
304 311
             }
305
-        } else if (is_string($this->_select)) {
312
+        }
313
+        else if (is_string($this->_select)) {
306 314
             $select = $this->addColumnAlias($this->_select);
307 315
         }
308 316
         return $this->getAdapter()->sqlSelect($select, $this->_queryOptions);
@@ -322,7 +330,8 @@  discard block
 block discarded – undo
322 330
 
323 331
         if ($alias) {
324 332
             $this->_select[$alias] = $select;
325
-        } else {
333
+        }
334
+        else {
326 335
             $this->_select[] = $select;
327 336
         }
328 337
 
@@ -339,9 +348,11 @@  discard block
 block discarded – undo
339 348
         if (is_string($select) && $newSelect = $this->getLookupBuilder()->buildJoin($this, $select)) {
340 349
             list($t_alias, $column) = $newSelect;
341 350
             $this->pushToSelect($t_alias . '.' . $column, $alias);
342
-        } else if ($select instanceof IToSql) {
351
+        }
352
+        else if ($select instanceof IToSql) {
343 353
             $this->pushToSelect($select->setQb($this), $alias);
344
-        } else {
354
+        }
355
+        else {
345 356
             $this->pushToSelect($select, $alias);
346 357
         }
347 358
 
@@ -364,7 +375,8 @@  discard block
 block discarded – undo
364 375
             foreach ($select as $key => $part) {
365 376
                 $this->addSelect($part, $key);
366 377
             }
367
-        } else {
378
+        }
379
+        else {
368 380
             $this->addSelect($select);
369 381
         }
370 382
 
@@ -478,10 +490,12 @@  discard block
 block discarded – undo
478 490
     {
479 491
         if ($tableName instanceof QueryBuilder) {
480 492
             $this->_join[] = $this->getAdapter()->sqlJoin($joinType, $tableName, $on, $alias, $index);
481
-        } else {
493
+        }
494
+        else {
482 495
             if ($joinType === 'RAW' && !empty($tableName)) {
483 496
                 $join = $this->getAdapter()->quoteSql($tableName);
484
-            } else {
497
+            }
498
+            else {
485 499
                 $join = $this->getAdapter()->sqlJoin($joinType, $tableName, $on, $alias);
486 500
             }
487 501
 
@@ -553,7 +567,8 @@  discard block
 block discarded – undo
553 567
             foreach ($columns as $column) {
554 568
                 $this->addOrder($column);
555 569
             }
556
-        } else {
570
+        }
571
+        else {
557 572
             $this->addOrder($columns);
558 573
         }
559 574
 
@@ -587,11 +602,13 @@  discard block
 block discarded – undo
587 602
                     }
588 603
 
589 604
                     $this->_order[] = $_column;
590
-                } else {
605
+                }
606
+                else {
591 607
                     $this->_order[] = current($temp);
592 608
                 }
593 609
             }
594
-        } else {
610
+        }
611
+        else {
595 612
             $this->_order[] = $column;
596 613
         }
597 614
 
@@ -680,14 +697,18 @@  discard block
 block discarded – undo
680 697
                 if (is_numeric($key)) {
681 698
                     if ($value instanceof IToSql) {
682 699
                         $parts[] = $this->parseCondition($value, $operator);
683
-                    } elseif ($value instanceof QueryBuilder) {
700
+                    }
701
+                    elseif ($value instanceof QueryBuilder) {
684 702
                         $parts[] = $this->parseCondition($value, $operator);
685
-                    } else if (is_array($value)) {
703
+                    }
704
+                    else if (is_array($value)) {
686 705
                         $parts[] = $this->parseCondition($value, $operator);
687
-                    } else if (is_string($value)) {
706
+                    }
707
+                    else if (is_string($value)) {
688 708
                         $parts[] = $value;
689 709
                     }
690
-                } else {
710
+                }
711
+                else {
691 712
                     $tableAlias = $this->getAlias();
692 713
                     $value = $this->getAdapter()->prepareValue($value);
693 714
 
@@ -708,13 +729,16 @@  discard block
 block discarded – undo
708 729
                 return '(' . implode(') ' . $operator . ' (', $parts) . ')';
709 730
             }
710 731
 
711
-        } else if ($condition instanceof IToSql) {
732
+        }
733
+        else if ($condition instanceof IToSql) {
712 734
             return $condition
713 735
                 ->setQb($this)
714 736
                 ->toSql();
715
-        } else if ($condition instanceof QueryBuilder) {
737
+        }
738
+        else if ($condition instanceof QueryBuilder) {
716 739
             return $condition->toSQL();
717
-        } else if (is_string($condition)) {
740
+        }
741
+        else if (is_string($condition)) {
718 742
             return $condition;
719 743
         }
720 744
 
@@ -727,7 +751,8 @@  discard block
 block discarded – undo
727 751
         foreach ($operands as $operand) {
728 752
             if (is_array($operand)) {
729 753
                 $operand = $this->buildCondition($operand, $params);
730
-            } else {
754
+            }
755
+            else {
731 756
                 $operand = $this->parseCondition($operand);
732 757
             }
733 758
             if ($operand !== '') {
@@ -788,7 +813,8 @@  discard block
 block discarded – undo
788 813
         foreach ($this->_whereAnd as $condition) {
789 814
             if (empty($where)) {
790 815
                 $where = ['and', $condition];
791
-            } else {
816
+            }
817
+            else {
792 818
                 $where = ['and', $where, ['and', $condition]];
793 819
             }
794 820
         }
@@ -796,7 +822,8 @@  discard block
 block discarded – undo
796 822
         foreach ($this->_whereOr as $condition) {
797 823
             if (empty($where)) {
798 824
                 $where = ['or', $condition];
799
-            } else {
825
+            }
826
+            else {
800 827
                 $where = ['or', $where, ['and', $condition]];
801 828
             }
802 829
         }
@@ -1121,7 +1148,8 @@  discard block
 block discarded – undo
1121 1148
     {
1122 1149
         if (strpos($order, '-') === false) {
1123 1150
             $direction = 'ASC';
1124
-        } else {
1151
+        }
1152
+        else {
1125 1153
             $direction = 'DESC';
1126 1154
             $order = substr($order, 1);
1127 1155
         }
@@ -1158,12 +1186,14 @@  discard block
 block discarded – undo
1158 1186
                 }
1159 1187
                 else if ($column === '?') {
1160 1188
                     $order[] = $this->getAdapter()->getRandomOrder();
1161
-                } else {
1189
+                }
1190
+                else {
1162 1191
                     list($newColumn, $direction) = $this->buildOrderJoin($column);
1163 1192
                     $order[$this->applyTableAlias($newColumn)] = $direction;
1164 1193
                 }
1165 1194
             }
1166
-        } else {
1195
+        }
1196
+        else {
1167 1197
             $order[] = $this->buildOrderJoin($this->_order);
1168 1198
         }
1169 1199
 
@@ -1210,7 +1240,8 @@  discard block
 block discarded – undo
1210 1240
     {
1211 1241
         if ($this->_alias !== null && !is_array($this->_from)) {
1212 1242
             $from = [$this->_alias => $this->_from];
1213
-        } else {
1243
+        }
1244
+        else {
1214 1245
             $from = $this->_from;
1215 1246
         }
1216 1247
         $sql = $this->getAdapter()->sqlFrom($from);
Please login to merge, or discard this patch.