Completed
Push — master ( 2d5d38...3ed246 )
by Maksim
04:06
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   +60 added lines, -30 removed lines patch added patch discarded remove patch
@@ -239,12 +239,15 @@  discard block
 block discarded – undo
239 239
         if ($newSelect === false) {
240 240
             if ($tableAlias === null || $rawColumn === '*') {
241 241
                 $columns = $rawColumn;
242
-            } elseif (strpos($rawColumn, '.') !== false) {
242
+            }
243
+            elseif (strpos($rawColumn, '.') !== false) {
243 244
                 $columns = $rawColumn;
244
-            } else {
245
+            }
246
+            else {
245 247
                 $columns = $tableAlias . '.' . $rawColumn;
246 248
             }
247
-        } else {
249
+        }
250
+        else {
248 251
             list($alias, $joinColumn) = $newSelect;
249 252
             $columns = $alias . '.' . $joinColumn;
250 253
         }
@@ -270,17 +273,21 @@  discard block
 block discarded – undo
270 273
             foreach ($this->_select as $alias => $column) {
271 274
                 if ($column instanceof Aggregation) {
272 275
                     $select[$alias] = $this->buildSelectFromAggregation($column);
273
-                } else if (is_string($column)) {
276
+                }
277
+                else if (is_string($column)) {
274 278
                     if (strpos($column, 'SELECT') !== false) {
275 279
                         $select[$alias] = $column;
276
-                    } else {
280
+                    }
281
+                    else {
277 282
                         $select[$alias] = $this->addColumnAlias($builder->fetchColumnName($column));
278 283
                     }
279
-                } else {
284
+                }
285
+                else {
280 286
                     $select[$alias] = $column;
281 287
                 }
282 288
             }
283
-        } else if (is_string($this->_select)) {
289
+        }
290
+        else if (is_string($this->_select)) {
284 291
             $select = $this->addColumnAlias($this->_select);
285 292
         }
286 293
         return $this->getAdapter()->sqlSelect($select, $this->_queryOptions);
@@ -300,7 +307,8 @@  discard block
 block discarded – undo
300 307
 
301 308
         if ($alias) {
302 309
             $this->_select[$alias] = $select;
303
-        } else {
310
+        }
311
+        else {
304 312
             $this->_select[] = $select;
305 313
         }
306 314
 
@@ -317,9 +325,11 @@  discard block
 block discarded – undo
317 325
         if (is_string($select) && $newSelect = $this->getLookupBuilder()->buildJoin($this, $select)) {
318 326
             list($t_alias, $column) = $newSelect;
319 327
             $this->pushToSelect($t_alias . '.' . $column, $alias);
320
-        } else if ($select instanceof IToSql) {
328
+        }
329
+        else if ($select instanceof IToSql) {
321 330
             $this->pushToSelect($select->setQb($this), $alias);
322
-        } else {
331
+        }
332
+        else {
323 333
             $this->pushToSelect($select, $alias);
324 334
         }
325 335
 
@@ -342,7 +352,8 @@  discard block
 block discarded – undo
342 352
             foreach ($select as $key => $part) {
343 353
                 $this->addSelect($part, $key);
344 354
             }
345
-        } else {
355
+        }
356
+        else {
346 357
             $this->addSelect($select);
347 358
         }
348 359
 
@@ -456,10 +467,12 @@  discard block
 block discarded – undo
456 467
     {
457 468
         if ($tableName instanceof QueryBuilder) {
458 469
             $this->_join[] = $this->getAdapter()->sqlJoin($joinType, $tableName, $on, $alias, $index);
459
-        } else {
470
+        }
471
+        else {
460 472
             if ($joinType === 'RAW' && !empty($tableName)) {
461 473
                 $join = $this->getAdapter()->quoteSql($tableName);
462
-            } else {
474
+            }
475
+            else {
463 476
                 $join = $this->getAdapter()->sqlJoin($joinType, $tableName, $on, $alias);
464 477
             }
465 478
 
@@ -531,7 +544,8 @@  discard block
 block discarded – undo
531 544
             foreach ($columns as $column) {
532 545
                 $this->addOrder($column);
533 546
             }
534
-        } else {
547
+        }
548
+        else {
535 549
             $this->addOrder($columns);
536 550
         }
537 551
 
@@ -565,11 +579,13 @@  discard block
 block discarded – undo
565 579
                     }
566 580
 
567 581
                     $this->_order[] = $_column;
568
-                } else {
582
+                }
583
+                else {
569 584
                     $this->_order[] = current($temp);
570 585
                 }
571 586
             }
572
-        } else {
587
+        }
588
+        else {
573 589
             $this->_order[] = $column;
574 590
         }
575 591
 
@@ -655,14 +671,18 @@  discard block
 block discarded – undo
655 671
                 if (is_numeric($key)) {
656 672
                     if ($value instanceof IToSql) {
657 673
                         $parts[] = $this->parseCondition($value, $operator);
658
-                    } elseif ($value instanceof QueryBuilder) {
674
+                    }
675
+                    elseif ($value instanceof QueryBuilder) {
659 676
                         $parts[] = $this->parseCondition($value, $operator);
660
-                    } else if (is_array($value)) {
677
+                    }
678
+                    else if (is_array($value)) {
661 679
                         $parts[] = $this->parseCondition($value, $operator);
662
-                    } else if (is_string($value)) {
680
+                    }
681
+                    else if (is_string($value)) {
663 682
                         $parts[] = $value;
664 683
                     }
665
-                } else {
684
+                }
685
+                else {
666 686
                     $tableAlias = $this->getAlias();
667 687
                     $value = $this->getAdapter()->prepareValue($value);
668 688
 
@@ -683,13 +703,16 @@  discard block
 block discarded – undo
683 703
                 return '(' . implode(') ' . $operator . ' (', $parts) . ')';
684 704
             }
685 705
 
686
-        } else if ($condition instanceof IToSql) {
706
+        }
707
+        else if ($condition instanceof IToSql) {
687 708
             return $condition
688 709
                 ->setQb($this)
689 710
                 ->toSql();
690
-        } else if ($condition instanceof QueryBuilder) {
711
+        }
712
+        else if ($condition instanceof QueryBuilder) {
691 713
             return $condition->toSQL();
692
-        } else if (is_string($condition)) {
714
+        }
715
+        else if (is_string($condition)) {
693 716
             return $condition;
694 717
         }
695 718
 
@@ -702,7 +725,8 @@  discard block
 block discarded – undo
702 725
         foreach ($operands as $operand) {
703 726
             if (is_array($operand)) {
704 727
                 $operand = $this->buildCondition($operand, $params);
705
-            } else {
728
+            }
729
+            else {
706 730
                 $operand = $this->parseCondition($operand);
707 731
             }
708 732
             if ($operand !== '') {
@@ -763,7 +787,8 @@  discard block
 block discarded – undo
763 787
         foreach ($this->_whereAnd as $condition) {
764 788
             if (empty($where)) {
765 789
                 $where = ['and', $condition];
766
-            } else {
790
+            }
791
+            else {
767 792
                 $where = ['and', $where, ['and', $condition]];
768 793
             }
769 794
         }
@@ -771,7 +796,8 @@  discard block
 block discarded – undo
771 796
         foreach ($this->_whereOr as $condition) {
772 797
             if (empty($where)) {
773 798
                 $where = ['or', $condition];
774
-            } else {
799
+            }
800
+            else {
775 801
                 $where = ['or', $where, ['and', $condition]];
776 802
             }
777 803
         }
@@ -1086,7 +1112,8 @@  discard block
 block discarded – undo
1086 1112
     {
1087 1113
         if (strpos($order, '-') === false) {
1088 1114
             $direction = 'ASC';
1089
-        } else {
1115
+        }
1116
+        else {
1090 1117
             $direction = 'DESC';
1091 1118
             $order = substr($order, 1);
1092 1119
         }
@@ -1123,12 +1150,14 @@  discard block
 block discarded – undo
1123 1150
                 }
1124 1151
                 else if ($column === '?') {
1125 1152
                     $order[] = $this->getAdapter()->getRandomOrder();
1126
-                } else {
1153
+                }
1154
+                else {
1127 1155
                     list($newColumn, $direction) = $this->buildOrderJoin($column);
1128 1156
                     $order[$this->applyTableAlias($newColumn)] = $direction;
1129 1157
                 }
1130 1158
             }
1131
-        } else {
1159
+        }
1160
+        else {
1132 1161
             $order[] = $this->buildOrderJoin($this->_order);
1133 1162
         }
1134 1163
 
@@ -1175,7 +1204,8 @@  discard block
 block discarded – undo
1175 1204
     {
1176 1205
         if ($this->_alias !== null && !is_array($this->_from)) {
1177 1206
             $from = [$this->_alias => $this->_from];
1178
-        } else {
1207
+        }
1208
+        else {
1179 1209
             $from = $this->_from;
1180 1210
         }
1181 1211
         $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.