Passed
Push — master ( 3ed246...04b8fa )
by Maksim
07:23
created
src/BaseLookupCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 
107 107
             case 'in':
108 108
                 if (is_array($value)) {
109
-                    $quotedValues = array_map(function ($item) use ($adapter) {
109
+                    $quotedValues = array_map(function($item) use ($adapter) {
110 110
                         return $adapter->quoteValue($item);
111 111
                     }, $value);
112 112
                     $sqlValue = implode(', ', $quotedValues);
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,11 +39,14 @@  discard block
 block discarded – undo
39 39
 
40 40
                 if ($value instanceof Expression) {
41 41
                     $sqlValue = $value->toSQL();
42
-                } else if ($value instanceof QueryBuilder) {
42
+                }
43
+                else if ($value instanceof QueryBuilder) {
43 44
                     $sqlValue = '(' . $value->toSQL() . ')';
44
-                } else if (strpos($value, 'SELECT') !== false) {
45
+                }
46
+                else if (strpos($value, 'SELECT') !== false) {
45 47
                     $sqlValue = '(' . $value . ')';
46
-                } else {
48
+                }
49
+                else {
47 50
                     $sqlValue = $adapter->quoteValue($value);
48 51
                 }
49 52
                 return $adapter->quoteColumn($column) . '=' . $sqlValue;
@@ -110,9 +113,11 @@  discard block
 block discarded – undo
110 113
                         return $adapter->quoteValue($item);
111 114
                     }, $value);
112 115
                     $sqlValue = implode(', ', $quotedValues);
113
-                } else if ($value instanceof QueryBuilder) {
116
+                }
117
+                else if ($value instanceof QueryBuilder) {
114 118
                     $sqlValue = $value->toSQL();
115
-                } else {
119
+                }
120
+                else {
116 121
                     $sqlValue = $adapter->quoteSql($value);
117 122
                 }
118 123
                 return $adapter->quoteColumn($column) . ' IN (' . $sqlValue . ')';
Please login to merge, or discard this patch.
src/BaseAdapter.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     public function setDriver($driver)
109 109
     {
110 110
         if (!($driver instanceof \PDO || $driver instanceof Connection)) {
111
-            throw new QBException('Drive must be instance PDO or '. Connection::class);
111
+            throw new QBException('Drive must be instance PDO or ' . Connection::class);
112 112
         }
113 113
 
114 114
         $this->driver = $driver;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                 $values[] = '(' . implode(', ', $record) . ')';
341 341
             }
342 342
 
343
-            $sql = 'INSERT'. $options .' INTO ' . $this->quoteTableName($tableName) . ' (' . implode(', ', $columns) . ') VALUES ' . implode(', ', $values);
343
+            $sql = 'INSERT' . $options . ' INTO ' . $this->quoteTableName($tableName) . ' (' . implode(', ', $columns) . ') VALUES ' . implode(', ', $values);
344 344
 
345 345
             return $this->quoteSql($sql);
346 346
         }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         $values = array_map([$this, 'quoteValue'], $rows);
349 349
         $columns = array_map([$this, 'quoteColumn'], array_keys($rows));
350 350
 
351
-        $sql = 'INSERT'. $options .' INTO ' . $this->quoteTableName($tableName) . ' (' . implode(', ', $columns) . ') VALUES (' . implode(', ', $values) . ')';
351
+        $sql = 'INSERT' . $options . ' INTO ' . $this->quoteTableName($tableName) . ' (' . implode(', ', $columns) . ') VALUES (' . implode(', ', $values) . ')';
352 352
 
353 353
         return $this->quoteSql($sql);
354 354
     }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             $options = " {$options} ";
365 365
         }
366 366
 
367
-        return 'UPDATE '. $options . $this->quoteTableName($tableName) . ' SET ' . implode(', ', $parts);
367
+        return 'UPDATE ' . $options . $this->quoteTableName($tableName) . ' SET ' . implode(', ', $parts);
368 368
     }
369 369
 
370 370
     /**
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
         $toSql = [$joinType];
630 630
         if (is_string($tableName) && $tableName = $this->getRawTableName($tableName)) {
631 631
             if (strpos($tableName, 'SELECT') !== false) {
632
-                $toSql[] = '(' . $this->quoteSql($tableName) . ')' ;
632
+                $toSql[] = '(' . $this->quoteSql($tableName) . ')';
633 633
             } else {
634
-                $toSql[]  = $this->quoteTableName($tableName);
634
+                $toSql[] = $this->quoteTableName($tableName);
635 635
             }
636 636
         } else if ($tableName instanceof QueryBuilder) {
637
-            $toSql[] =  '(' . $this->quoteSql($tableName->toSQL()) . ')' ;
637
+            $toSql[] = '(' . $this->quoteSql($tableName->toSQL()) . ')';
638 638
         } else {
639 639
             throw new QBException('Incorrect table name');
640 640
         }
Please login to merge, or discard this patch.
Braces   +42 added lines, -21 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@  discard block
 block discarded – undo
55 55
         if (($pos = strrpos($name, '.')) !== false) {
56 56
             $prefix = $this->quoteTableName(substr($name, 0, $pos)) . '.';
57 57
             $name = substr($name, $pos + 1);
58
-        } else {
58
+        }
59
+        else {
59 60
             $prefix = '';
60 61
         }
61 62
         return $prefix . $this->quoteSimpleColumnName($name);
@@ -133,13 +134,17 @@  discard block
 block discarded – undo
133 134
     {
134 135
         if ($value instanceof IToSql) {
135 136
             return $value->toSql();
136
-        } else if ($value === true || strtolower($value) === 'true') {
137
+        }
138
+        else if ($value === true || strtolower($value) === 'true') {
137 139
             return 'TRUE';
138
-        } else if ($value === false || strtolower($value) === 'false') {
140
+        }
141
+        else if ($value === false || strtolower($value) === 'false') {
139 142
             return 'FALSE';
140
-        } else if ($value === null || strtolower($value) === 'null') {
143
+        }
144
+        else if ($value === null || strtolower($value) === 'null') {
141 145
             return 'NULL';
142
-        } else if (is_string($value) && $driver = $this->getDriver()) {
146
+        }
147
+        else if (is_string($value) && $driver = $this->getDriver()) {
143 148
             return $driver->quote($value);
144 149
         }
145 150
 
@@ -213,7 +218,8 @@  discard block
 block discarded – undo
213 218
     {
214 219
         if ($rawValue === true || $rawValue === false || $rawValue === 'true' || $rawValue === 'false') {
215 220
             return $this->getBoolean($rawValue);
216
-        } else if ($rawValue === 'null' || $rawValue === null) {
221
+        }
222
+        else if ($rawValue === 'null' || $rawValue === null) {
217 223
             return 'NULL';
218 224
         }
219 225
         return $rawValue;
@@ -267,7 +273,8 @@  discard block
 block discarded – undo
267 273
         foreach ($columns as $i => $column) {
268 274
             if ($column instanceof Expression) {
269 275
                 $columns[$i] = $column->toSQL();
270
-            } else if (strpos($column, '(') === false) {
276
+            }
277
+            else if (strpos($column, '(') === false) {
271 278
                 $columns[$i] = $this->quoteColumn($column);
272 279
             }
273 280
         }
@@ -417,12 +424,14 @@  discard block
 block discarded – undo
417 424
             foreach ($columns as $name => $type) {
418 425
                 if (is_string($name)) {
419 426
                     $cols[] = "\t" . $this->quoteColumn($name) . ' ' . $type;
420
-                } else {
427
+                }
428
+                else {
421 429
                     $cols[] = "\t" . $type;
422 430
                 }
423 431
             }
424 432
             $sql = ($ifNotExists ? "CREATE TABLE IF NOT EXISTS " : "CREATE TABLE ") . $this->quoteTableName($tableName) . " (\n" . implode(",\n", $cols) . "\n)";
425
-        } else {
433
+        }
434
+        else {
426 435
             $sql = ($ifNotExists ? "CREATE TABLE IF NOT EXISTS " : "CREATE TABLE ") . $this->quoteTableName($tableName) . " " . $this->quoteSql($columns);
427 436
         }
428 437
         return empty($options) ? $sql : $sql . ' ' . $options;
@@ -472,11 +481,14 @@  discard block
 block discarded – undo
472 481
     {
473 482
         if ($value === 'true' || $value === true) {
474 483
             return 'TRUE';
475
-        } else if ($value === null || $value === 'null') {
484
+        }
485
+        else if ($value === null || $value === 'null') {
476 486
             return 'NULL';
477
-        } else if ($value === false || $value === 'false') {
487
+        }
488
+        else if ($value === false || $value === 'false') {
478 489
             return 'FALSE';
479
-        } else {
490
+        }
491
+        else {
480 492
             return $value;
481 493
         }
482 494
     }
@@ -604,12 +616,14 @@  discard block
 block discarded – undo
604 616
         foreach ($tables as $tableAlias => $table) {
605 617
             if ($table instanceof QueryBuilder) {
606 618
                 $tableRaw = $table->toSQL();
607
-            } else {
619
+            }
620
+            else {
608 621
                 $tableRaw = $this->getRawTableName($table);
609 622
             }
610 623
             if (strpos($tableRaw, 'SELECT') !== false) {
611 624
                 $quotedTableNames[] = '(' . $tableRaw . ')' . (is_numeric($tableAlias) ? '' : ' AS ' . $this->quoteTableName($tableAlias));
612
-            } else {
625
+            }
626
+            else {
613 627
                 $quotedTableNames[] = $this->quoteTableName($tableRaw) . (is_numeric($tableAlias) ? '' : ' AS ' . $this->quoteTableName($tableAlias));
614 628
             }
615 629
         }
@@ -630,12 +644,15 @@  discard block
 block discarded – undo
630 644
         if (is_string($tableName) && $tableName = $this->getRawTableName($tableName)) {
631 645
             if (strpos($tableName, 'SELECT') !== false) {
632 646
                 $toSql[] = '(' . $this->quoteSql($tableName) . ')' ;
633
-            } else {
647
+            }
648
+            else {
634 649
                 $toSql[]  = $this->quoteTableName($tableName);
635 650
             }
636
-        } else if ($tableName instanceof QueryBuilder) {
651
+        }
652
+        else if ($tableName instanceof QueryBuilder) {
637 653
             $toSql[] =  '(' . $this->quoteSql($tableName->toSQL()) . ')' ;
638
-        } else {
654
+        }
655
+        else {
639 656
             throw new QBException('Incorrect table name');
640 657
         }
641 658
 
@@ -647,11 +664,13 @@  discard block
 block discarded – undo
647 664
             $onSQL = [];
648 665
             if (is_string($on)) {
649 666
                 $onSQL[] = $this->quoteSql($on);
650
-            } else {
667
+            }
668
+            else {
651 669
                 foreach ($on as $leftColumn => $rightColumn) {
652 670
                     if ($rightColumn instanceof Expression) {
653 671
                         $onSQL[] = $this->quoteColumn($leftColumn) . '=' . $this->quoteSql($rightColumn->toSQL());
654
-                    } else {
672
+                    }
673
+                    else {
655 674
                         $onSQL[] = $this->quoteColumn($leftColumn) . '=' . $this->quoteColumn($rightColumn);
656 675
                     }
657 676
                 }
@@ -691,7 +710,8 @@  discard block
 block discarded – undo
691 710
             $sql = $having
692 711
                 ->setQb($queryBuilder)
693 712
                 ->toSql();
694
-        } else {
713
+        }
714
+        else {
695 715
             $sql = $this->quoteSql($having);
696 716
         }
697 717
 
@@ -711,7 +731,8 @@  discard block
 block discarded – undo
711 731
 
712 732
         if ($union instanceof QueryBuilder) {
713 733
             $unionSQL = $union->setOrder(null)->toSQL();
714
-        } else {
734
+        }
735
+        else {
715 736
             $unionSQL = $this->quoteSql($union);
716 737
         }
717 738
         return ($all ? 'UNION ALL' : 'UNION') . ' (' . $unionSQL . ')';
Please login to merge, or discard this patch.
src/Expression/Expression.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,10 +50,10 @@
 block discarded – undo
50 50
         if (strpos($sql, '?'))
51 51
         {
52 52
             if (mb_substr_count($sql, '?') !== count($this->params)) {
53
-                throw new QBException('Incorrect parameters count in Expression: "'.addslashes($this->expression).'"');
53
+                throw new QBException('Incorrect parameters count in Expression: "' . addslashes($this->expression) . '"');
54 54
             }
55 55
 
56
-            $sql = preg_replace_callback('~\?~', function ($matches) {
56
+            $sql = preg_replace_callback('~\?~', function($matches) {
57 57
                 return $this->qb->getAdapter()->quoteValue(
58 58
                     $this->getNextParam()
59 59
                 );
Please login to merge, or discard this patch.
src/QueryBuilder.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
     public function generateDeleteSql()
825 825
     {
826
-        $options = $this->_queryOptions ;
826
+        $options = $this->_queryOptions;
827 827
         if ($options) {
828 828
             $options = " {$options} ";
829 829
         }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
         $tableName = $this->getAdapter()->getRawTableName($table);
981 981
 
982 982
         if (strpos($tableName, '.') !== false) {
983
-            $tableName = substr($tableName, strpos($tableName, '.')+1);
983
+            $tableName = substr($tableName, strpos($tableName, '.') + 1);
984 984
         }
985 985
 
986 986
         return strtr('{table}_{count}', [
Please login to merge, or discard this 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.
src/ConnectionManager.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,8 @@
 block discarded – undo
50 50
         foreach ($config as $key => $value) {
51 51
             if (method_exists($this, 'set' . ucfirst($key))) {
52 52
                 $this->{'set' . ucfirst($key)}($value);
53
-            } else {
53
+            }
54
+            else {
54 55
                 $this->{$key} = $value;
55 56
             }
56 57
         }
Please login to merge, or discard this patch.
src/Database/Pgsql/LookupCollection.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@
 block discarded – undo
15 15
         ];
16 16
         if (in_array($lookup, $lookups)) {
17 17
             return true;
18
-        } else {
18
+        }
19
+        else {
19 20
             return parent::has($lookup);
20 21
         }
21 22
     }
Please login to merge, or discard this patch.
src/Database/Pgsql/Adapter.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -193,11 +193,14 @@
 block discarded – undo
193 193
     {
194 194
         if ($value instanceof \DateTime) {
195 195
             $value = $value->format($format);
196
-        } elseif ($value === null) {
196
+        }
197
+        elseif ($value === null) {
197 198
             $value = date($format);
198
-        } elseif (is_numeric($value)) {
199
+        }
200
+        elseif (is_numeric($value)) {
199 201
             $value = date($format, $value);
200
-        } elseif (is_string($value)) {
202
+        }
203
+        elseif (is_string($value)) {
201 204
             $value = date($format, strtotime($value));
202 205
         }
203 206
         return $value;
Please login to merge, or discard this patch.
src/Database/Mysql/Adapter.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,7 +92,8 @@  discard block
 block discarded – undo
92 92
     {
93 93
         if (gettype($value) === 'boolean') {
94 94
             return (int)$value;
95
-        } else {
95
+        }
96
+        else {
96 97
             return $value ? 1 : 0;
97 98
         }
98 99
     }
@@ -101,11 +102,14 @@  discard block
 block discarded – undo
101 102
     {
102 103
         if ($value instanceof \DateTime) {
103 104
             $value = $value->format($format);
104
-        } elseif ($value === null) {
105
+        }
106
+        elseif ($value === null) {
105 107
             $value = date($format);
106
-        } elseif (is_numeric($value)) {
108
+        }
109
+        elseif (is_numeric($value)) {
107 110
             $value = date($format, $value);
108
-        } elseif (is_string($value)) {
111
+        }
112
+        elseif (is_string($value)) {
109 113
             $value = date($format, strtotime($value));
110 114
         }
111 115
         return $value;
@@ -170,7 +174,8 @@  discard block
 block discarded – undo
170 174
                 $sql .= ' OFFSET ' . $offset;
171 175
             }
172 176
             return ' ' . $sql;
173
-        } elseif ($this->hasOffset($offset)) {
177
+        }
178
+        elseif ($this->hasOffset($offset)) {
174 179
             // limit is not optional in MySQL
175 180
             // http://stackoverflow.com/a/271650/1106908
176 181
             // http://dev.mysql.com/doc/refman/5.0/en/select.html#idm47619502796240
@@ -196,7 +201,8 @@  discard block
 block discarded – undo
196 201
         }
197 202
         if (isset($row['Create Table'])) {
198 203
             $sql = $row['Create Table'];
199
-        } else {
204
+        }
205
+        else {
200 206
             $row = array_values($row);
201 207
             $sql = $row[1];
202 208
         }
Please login to merge, or discard this patch.
src/Database/Sqlite/Adapter.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -178,11 +178,14 @@  discard block
 block discarded – undo
178 178
     {
179 179
         if ($value instanceof \DateTime) {
180 180
             $value = $value->format($format);
181
-        } elseif ($value === null) {
181
+        }
182
+        elseif ($value === null) {
182 183
             $value = date($format);
183
-        } elseif (is_numeric($value)) {
184
+        }
185
+        elseif (is_numeric($value)) {
184 186
             $value = date($format, $value);
185
-        } elseif (is_string($value)) {
187
+        }
188
+        elseif (is_string($value)) {
186 189
             $value = date($format, strtotime($value));
187 190
         }
188 191
         return (string)$value;
@@ -219,7 +222,8 @@  discard block
 block discarded – undo
219 222
                 $sql .= ' OFFSET ' . $offset;
220 223
             }
221 224
             return ' ' . $sql;
222
-        } elseif ($this->hasOffset($offset)) {
225
+        }
226
+        elseif ($this->hasOffset($offset)) {
223 227
             // limit is not optional in SQLite
224 228
             // http://www.sqlite.org/syntaxdiagrams.html#select-stmt
225 229
             // If the LIMIT expression evaluates to a negative value, then there
Please login to merge, or discard this patch.