Passed
Pull Request — master (#157)
by
unknown
03:55
created
src/Ifsnop/Mysqldump/Mysqldump.php 2 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -110,50 +110,50 @@  discard block
 block discarded – undo
110 110
      * @param array  $pdoSettings  PDO configured attributes
111 111
      */
112 112
     public function __construct(
113
-      $dsn = '',
114
-      $user = '',
115
-      $pass = '',
116
-      $dumpSettings = array(),
117
-      $pdoSettings = array()
113
+        $dsn = '',
114
+        $user = '',
115
+        $pass = '',
116
+        $dumpSettings = array(),
117
+        $pdoSettings = array()
118 118
     ) {
119 119
         $dumpSettingsDefault = array(
120
-          'include-tables' => array(),
121
-          'exclude-tables' => array(),
122
-          'compress' => Mysqldump::NONE,
123
-          'init_commands' => array(),
124
-          'no-data' => array(),
125
-          'reset-auto-increment' => false,
126
-          'add-drop-database' => false,
127
-          'add-drop-table' => false,
128
-          'add-drop-trigger' => true,
129
-          'add-locks' => true,
130
-          'complete-insert' => false,
131
-          'databases' => false,
132
-          'default-character-set' => Mysqldump::UTF8,
133
-          'disable-keys' => true,
134
-          'extended-insert' => true,
135
-          'events' => false,
136
-          'hex-blob' => true, /* faster than escaped content */
137
-          'insert-ignore' => false,
138
-          'net_buffer_length' => self::MAXLINESIZE,
139
-          'no-autocommit' => true,
140
-          'no-create-info' => false,
141
-          'lock-tables' => true,
142
-          'routines' => false,
143
-          'single-transaction' => true,
144
-          'skip-triggers' => false,
145
-          'skip-tz-utc' => false,
146
-          'skip-comments' => false,
147
-          'skip-dump-date' => false,
148
-          'skip-definer' => false,
149
-          'where' => '',
120
+            'include-tables' => array(),
121
+            'exclude-tables' => array(),
122
+            'compress' => Mysqldump::NONE,
123
+            'init_commands' => array(),
124
+            'no-data' => array(),
125
+            'reset-auto-increment' => false,
126
+            'add-drop-database' => false,
127
+            'add-drop-table' => false,
128
+            'add-drop-trigger' => true,
129
+            'add-locks' => true,
130
+            'complete-insert' => false,
131
+            'databases' => false,
132
+            'default-character-set' => Mysqldump::UTF8,
133
+            'disable-keys' => true,
134
+            'extended-insert' => true,
135
+            'events' => false,
136
+            'hex-blob' => true, /* faster than escaped content */
137
+            'insert-ignore' => false,
138
+            'net_buffer_length' => self::MAXLINESIZE,
139
+            'no-autocommit' => true,
140
+            'no-create-info' => false,
141
+            'lock-tables' => true,
142
+            'routines' => false,
143
+            'single-transaction' => true,
144
+            'skip-triggers' => false,
145
+            'skip-tz-utc' => false,
146
+            'skip-comments' => false,
147
+            'skip-dump-date' => false,
148
+            'skip-definer' => false,
149
+            'where' => '',
150 150
             /* deprecated */
151
-          'disable-foreign-keys-check' => true
151
+            'disable-foreign-keys-check' => true
152 152
         );
153 153
 
154 154
         $pdoSettingsDefault = array(
155
-          PDO::ATTR_PERSISTENT => true,
156
-          PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
155
+            PDO::ATTR_PERSISTENT => true,
156
+            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
157 157
         );
158 158
 
159 159
         $this->user = $user;
@@ -286,10 +286,10 @@  discard block
 block discarded – undo
286 286
                 case 'pgsql':
287 287
                 case 'dblib':
288 288
                     $this->dbHandler = @new PDO(
289
-                      $this->dsn,
290
-                      $this->user,
291
-                      $this->pass,
292
-                      $this->pdoSettings
289
+                        $this->dsn,
290
+                        $this->user,
291
+                        $this->pass,
292
+                        $this->pdoSettings
293 293
                     );
294 294
                     // Execute init commands once connected
295 295
                     foreach ($this->dumpSettings['init_commands'] as $stmt) {
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
             }
304 304
         } catch (PDOException $e) {
305 305
             throw new Exception(
306
-              "Connection to ".$this->dbType." failed with message: ".
307
-              $e->getMessage()
306
+                "Connection to ".$this->dbType." failed with message: ".
307
+                $e->getMessage()
308 308
             );
309 309
         }
310 310
 
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 
341 341
         // Store server settings and use sanner defaults to dump
342 342
         $this->compressManager->write(
343
-          $this->typeAdapter->backup_parameters()
343
+            $this->typeAdapter->backup_parameters()
344 344
         );
345 345
 
346 346
         if ($this->dumpSettings['databases']) {
347 347
             $this->compressManager->write(
348
-              $this->typeAdapter->getDatabaseHeader($this->dbName)
348
+                $this->typeAdapter->getDatabaseHeader($this->dbName)
349 349
             );
350 350
             if ($this->dumpSettings['add-drop-database']) {
351 351
                 $this->compressManager->write(
352
-                  $this->typeAdapter->add_drop_database($this->dbName)
352
+                    $this->typeAdapter->add_drop_database($this->dbName)
353 353
                 );
354 354
             }
355 355
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
         if ($this->dumpSettings['databases']) {
366 366
             $this->compressManager->write(
367
-              $this->typeAdapter->databases($this->dbName)
367
+                $this->typeAdapter->databases($this->dbName)
368 368
             );
369 369
         }
370 370
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 
386 386
         // Restore saved parameters
387 387
         $this->compressManager->write(
388
-          $this->typeAdapter->restore_parameters()
388
+            $this->typeAdapter->restore_parameters()
389 389
         );
390 390
         // Write some stats to output file
391 391
         $this->compressManager->write($this->getDumpFileFooter());
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
         if (!$this->dumpSettings['skip-comments']) {
405 405
             // Some info about software, source and time
406 406
             $header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php".PHP_EOL.
407
-              "--".PHP_EOL.
408
-              "-- Host: {$this->host}\tDatabase: {$this->dbName}".PHP_EOL.
409
-              "-- ------------------------------------------------------".PHP_EOL;
407
+                "--".PHP_EOL.
408
+                "-- Host: {$this->host}\tDatabase: {$this->dbName}".PHP_EOL.
409
+                "-- ------------------------------------------------------".PHP_EOL;
410 410
 
411 411
             if (!empty($this->version)) {
412 412
                 $header .= "-- Server version \t".$this->version.PHP_EOL;
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
                 if (in_array(current($row), $this->dumpSettings['include-tables'], true)) {
459 459
                     $this->tables[] = current($row);
460 460
                     $elem = array_search(
461
-                      current($row),
462
-                      $this->dumpSettings['include-tables']
461
+                        current($row),
462
+                        $this->dumpSettings['include-tables']
463 463
                     );
464 464
                     unset($this->dumpSettings['include-tables'][$elem]);
465 465
                 }
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
                 if (in_array(current($row), $this->dumpSettings['include-views'], true)) {
489 489
                     $this->views[] = current($row);
490 490
                     $elem = array_search(
491
-                      current($row),
492
-                      $this->dumpSettings['include-views']
491
+                        current($row),
492
+                        $this->dumpSettings['include-views']
493 493
                     );
494 494
                     unset($this->dumpSettings['include-views'][$elem]);
495 495
                 }
@@ -672,20 +672,20 @@  discard block
 block discarded – undo
672 672
             $ret = '';
673 673
             if (!$this->dumpSettings['skip-comments']) {
674 674
                 $ret = "--".PHP_EOL.
675
-                  "-- Table structure for table `$tableName`".PHP_EOL.
676
-                  "--".PHP_EOL.PHP_EOL;
675
+                    "-- Table structure for table `$tableName`".PHP_EOL.
676
+                    "--".PHP_EOL.PHP_EOL;
677 677
             }
678 678
             $stmt = $this->typeAdapter->show_create_table($tableName);
679 679
             foreach ($this->dbHandler->query($stmt) as $r) {
680 680
                 $this->compressManager->write($ret);
681 681
                 if ($this->dumpSettings['add-drop-table']) {
682 682
                     $this->compressManager->write(
683
-                      $this->typeAdapter->drop_table($tableName)
683
+                        $this->typeAdapter->drop_table($tableName)
684 684
                     );
685 685
                 }
686 686
                 $r = $this->hookTransformTableName($tableName, $r, TRUE);
687 687
                 $this->compressManager->write(
688
-                  $this->typeAdapter->create_table($r)
688
+                    $this->typeAdapter->create_table($r)
689 689
                 );
690 690
                 break;
691 691
             }
@@ -705,18 +705,18 @@  discard block
 block discarded – undo
705 705
     {
706 706
         $columnTypes = array();
707 707
         $columns = $this->dbHandler->query(
708
-          $this->typeAdapter->show_columns($tableName)
708
+            $this->typeAdapter->show_columns($tableName)
709 709
         );
710 710
         $columns->setFetchMode(PDO::FETCH_ASSOC);
711 711
 
712 712
         foreach ($columns as $key => $col) {
713 713
             $types = $this->typeAdapter->parseColumnType($col);
714 714
             $columnTypes[$col['Field']] = array(
715
-              'is_numeric'=> $types['is_numeric'],
716
-              'is_blob' => $types['is_blob'],
717
-              'type' => $types['type'],
718
-              'type_sql' => $col['Type'],
719
-              'is_virtual' => $types['is_virtual']
715
+                'is_numeric'=> $types['is_numeric'],
716
+                'is_blob' => $types['is_blob'],
717
+                'type' => $types['type'],
718
+                'type_sql' => $col['Type'],
719
+                'is_virtual' => $types['is_virtual']
720 720
             );
721 721
         }
722 722
 
@@ -734,8 +734,8 @@  discard block
 block discarded – undo
734 734
     {
735 735
         if (!$this->dumpSettings['skip-comments']) {
736 736
             $ret = "--".PHP_EOL.
737
-              "-- Stand-In structure for view `${viewName}`".PHP_EOL.
738
-              "--".PHP_EOL.PHP_EOL;
737
+                "-- Stand-In structure for view `${viewName}`".PHP_EOL.
738
+                "--".PHP_EOL.PHP_EOL;
739 739
             $this->compressManager->write($ret);
740 740
         }
741 741
         $stmt = $this->typeAdapter->show_create_view($viewName);
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
         foreach ($this->dbHandler->query($stmt) as $r) {
745 745
             if ($this->dumpSettings['add-drop-table']) {
746 746
                 $this->compressManager->write(
747
-                  $this->typeAdapter->drop_view($viewName)
747
+                    $this->typeAdapter->drop_view($viewName)
748 748
                 );
749 749
             }
750 750
 
751 751
             $this->compressManager->write(
752
-              $this->createStandInTable($viewName)
752
+                $this->createStandInTable($viewName)
753 753
             );
754 754
             break;
755 755
         }
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
         $ret = implode(PHP_EOL.",", $ret);
772 772
 
773 773
         $ret = "CREATE TABLE IF NOT EXISTS `$viewName` (".
774
-          PHP_EOL.$ret.PHP_EOL.");".PHP_EOL;
774
+            PHP_EOL.$ret.PHP_EOL.");".PHP_EOL;
775 775
 
776 776
         return $ret;
777 777
     }
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
     {
788 788
         if (!$this->dumpSettings['skip-comments']) {
789 789
             $ret = "--".PHP_EOL.
790
-              "-- View structure for view `${viewName}`".PHP_EOL.
791
-              "--".PHP_EOL.PHP_EOL;
790
+                "-- View structure for view `${viewName}`".PHP_EOL.
791
+                "--".PHP_EOL.PHP_EOL;
792 792
             $this->compressManager->write($ret);
793 793
         }
794 794
         $stmt = $this->typeAdapter->show_create_view($viewName);
@@ -798,10 +798,10 @@  discard block
 block discarded – undo
798 798
         foreach ($this->dbHandler->query($stmt) as $r) {
799 799
             // because we must replace table with view, we should delete it
800 800
             $this->compressManager->write(
801
-              $this->typeAdapter->drop_view($viewName)
801
+                $this->typeAdapter->drop_view($viewName)
802 802
             );
803 803
             $this->compressManager->write(
804
-              $this->typeAdapter->create_view($r)
804
+                $this->typeAdapter->create_view($r)
805 805
             );
806 806
             break;
807 807
         }
@@ -819,11 +819,11 @@  discard block
 block discarded – undo
819 819
         foreach ($this->dbHandler->query($stmt) as $r) {
820 820
             if ($this->dumpSettings['add-drop-trigger']) {
821 821
                 $this->compressManager->write(
822
-                  $this->typeAdapter->add_drop_trigger($triggerName)
822
+                    $this->typeAdapter->add_drop_trigger($triggerName)
823 823
                 );
824 824
             }
825 825
             $this->compressManager->write(
826
-              $this->typeAdapter->create_trigger($r)
826
+                $this->typeAdapter->create_trigger($r)
827 827
             );
828 828
             return;
829 829
         }
@@ -839,14 +839,14 @@  discard block
 block discarded – undo
839 839
     {
840 840
         if (!$this->dumpSettings['skip-comments']) {
841 841
             $ret = "--".PHP_EOL.
842
-              "-- Dumping routines for database '".$this->dbName."'".PHP_EOL.
843
-              "--".PHP_EOL.PHP_EOL;
842
+                "-- Dumping routines for database '".$this->dbName."'".PHP_EOL.
843
+                "--".PHP_EOL.PHP_EOL;
844 844
             $this->compressManager->write($ret);
845 845
         }
846 846
         $stmt = $this->typeAdapter->show_create_procedure($procedureName);
847 847
         foreach ($this->dbHandler->query($stmt) as $r) {
848 848
             $this->compressManager->write(
849
-              $this->typeAdapter->create_procedure($r)
849
+                $this->typeAdapter->create_procedure($r)
850 850
             );
851 851
             return;
852 852
         }
@@ -862,14 +862,14 @@  discard block
 block discarded – undo
862 862
     {
863 863
         if (!$this->dumpSettings['skip-comments']) {
864 864
             $ret = "--".PHP_EOL.
865
-              "-- Dumping events for database '".$this->dbName."'".PHP_EOL.
866
-              "--".PHP_EOL.PHP_EOL;
865
+                "-- Dumping events for database '".$this->dbName."'".PHP_EOL.
866
+                "--".PHP_EOL.PHP_EOL;
867 867
             $this->compressManager->write($ret);
868 868
         }
869 869
         $stmt = $this->typeAdapter->show_create_event($eventName);
870 870
         foreach ($this->dbHandler->query($stmt) as $r) {
871 871
             $this->compressManager->write(
872
-              $this->typeAdapter->create_event($r)
872
+                $this->typeAdapter->create_event($r)
873 873
             );
874 874
             return;
875 875
         }
@@ -961,10 +961,10 @@  discard block
 block discarded – undo
961 961
         }
962 962
 
963 963
         return call_user_func_array($this->transformColumnValueCallable, array(
964
-          $tableName,
965
-          $colName,
966
-          $colValue,
967
-          $row
964
+            $tableName,
965
+            $colName,
966
+            $colValue,
967
+            $row
968 968
         ));
969 969
     }
970 970
 
@@ -1039,13 +1039,13 @@  discard block
 block discarded – undo
1039 1039
             if ($onlyOnce || !$this->dumpSettings['extended-insert']) {
1040 1040
                 if ($this->dumpSettings['complete-insert']) {
1041 1041
                     $lineSize += $this->compressManager->write(
1042
-                      "INSERT$ignore INTO `$tableName` (".
1043
-                      implode(", ", $colNames).
1044
-                      ") VALUES (".implode(",", $vals).")"
1042
+                        "INSERT$ignore INTO `$tableName` (".
1043
+                        implode(", ", $colNames).
1044
+                        ") VALUES (".implode(",", $vals).")"
1045 1045
                     );
1046 1046
                 } else {
1047 1047
                     $lineSize += $this->compressManager->write(
1048
-                      "INSERT$ignore INTO `$tableName` VALUES (".implode(",", $vals).")"
1048
+                        "INSERT$ignore INTO `$tableName` VALUES (".implode(",", $vals).")"
1049 1049
                     );
1050 1050
                 }
1051 1051
                 $onlyOnce = false;
@@ -1079,9 +1079,9 @@  discard block
 block discarded – undo
1079 1079
         if (!$this->dumpSettings['skip-comments']) {
1080 1080
             $tableName = $this->hookTransformTableName($tableName, FALSE, TRUE);
1081 1081
             $this->compressManager->write(
1082
-              "--".PHP_EOL.
1083
-              "-- Dumping data for table `$tableName`".PHP_EOL.
1084
-              "--".PHP_EOL.PHP_EOL
1082
+                "--".PHP_EOL.
1083
+                "-- Dumping data for table `$tableName`".PHP_EOL.
1084
+                "--".PHP_EOL.PHP_EOL
1085 1085
             );
1086 1086
             $tableName = $this->hookTransformTableName($tableName, FALSE);
1087 1087
         }
@@ -1097,21 +1097,21 @@  discard block
 block discarded – undo
1097 1097
 
1098 1098
         if ($this->dumpSettings['add-locks']) {
1099 1099
             $this->compressManager->write(
1100
-              $this->typeAdapter->start_add_lock_table($tableName)
1100
+                $this->typeAdapter->start_add_lock_table($tableName)
1101 1101
             );
1102 1102
         }
1103 1103
 
1104 1104
         if ($this->dumpSettings['disable-keys']) {
1105 1105
             $tableName = $this->hookTransformTableName($tableName, FALSE, TRUE);
1106 1106
             $this->compressManager->write(
1107
-              $this->typeAdapter->start_add_disable_keys($tableName)
1107
+                $this->typeAdapter->start_add_disable_keys($tableName)
1108 1108
             );
1109 1109
         }
1110 1110
 
1111 1111
         // Disable autocommit for faster reload
1112 1112
         if ($this->dumpSettings['no-autocommit']) {
1113 1113
             $this->compressManager->write(
1114
-              $this->typeAdapter->start_disable_autocommit()
1114
+                $this->typeAdapter->start_disable_autocommit()
1115 1115
             );
1116 1116
         }
1117 1117
 
@@ -1129,13 +1129,13 @@  discard block
 block discarded – undo
1129 1129
     {
1130 1130
         if ($this->dumpSettings['disable-keys']) {
1131 1131
             $this->compressManager->write(
1132
-              $this->typeAdapter->end_add_disable_keys($tableName)
1132
+                $this->typeAdapter->end_add_disable_keys($tableName)
1133 1133
             );
1134 1134
         }
1135 1135
 
1136 1136
         if ($this->dumpSettings['add-locks']) {
1137 1137
             $this->compressManager->write(
1138
-              $this->typeAdapter->end_add_lock_table($tableName)
1138
+                $this->typeAdapter->end_add_lock_table($tableName)
1139 1139
             );
1140 1140
         }
1141 1141
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
         // Commit to enable autocommit
1151 1151
         if ($this->dumpSettings['no-autocommit']) {
1152 1152
             $this->compressManager->write(
1153
-              $this->typeAdapter->end_disable_autocommit()
1153
+                $this->typeAdapter->end_disable_autocommit()
1154 1154
             );
1155 1155
         }
1156 1156
 
@@ -1214,9 +1214,9 @@  discard block
 block discarded – undo
1214 1214
 abstract class CompressMethod
1215 1215
 {
1216 1216
     public static $enums = array(
1217
-      "None",
1218
-      "Gzip",
1219
-      "Bzip2"
1217
+        "None",
1218
+        "Gzip",
1219
+        "Bzip2"
1220 1220
     );
1221 1221
 
1222 1222
     /**
@@ -1362,8 +1362,8 @@  discard block
 block discarded – undo
1362 1362
 abstract class TypeAdapter
1363 1363
 {
1364 1364
     public static $enums = array(
1365
-      "Sqlite",
1366
-      "Mysql"
1365
+        "Sqlite",
1366
+        "Mysql"
1367 1367
     );
1368 1368
 
1369 1369
     /**
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
     public function show_create_table($tableName)
1418 1418
     {
1419 1419
         return "SELECT tbl_name as 'Table', sql as 'Create Table' ".
1420
-          "FROM sqlite_master ".
1421
-          "WHERE type='table' AND tbl_name='$tableName'";
1420
+            "FROM sqlite_master ".
1421
+            "WHERE type='table' AND tbl_name='$tableName'";
1422 1422
     }
1423 1423
 
1424 1424
     /**
@@ -1433,8 +1433,8 @@  discard block
 block discarded – undo
1433 1433
     public function show_create_view($viewName)
1434 1434
     {
1435 1435
         return "SELECT tbl_name as 'View', sql as 'Create View' ".
1436
-          "FROM sqlite_master ".
1437
-          "WHERE type='view' AND tbl_name='$viewName'";
1436
+            "FROM sqlite_master ".
1437
+            "WHERE type='view' AND tbl_name='$viewName'";
1438 1438
     }
1439 1439
 
1440 1440
     /**
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 
1627 1627
     // Numerical Mysql types
1628 1628
     public $mysqlTypes = array(
1629
-      'numerical' => array(
1629
+        'numerical' => array(
1630 1630
         'bit',
1631 1631
         'tinyint',
1632 1632
         'smallint',
@@ -1639,8 +1639,8 @@  discard block
 block discarded – undo
1639 1639
         'float',
1640 1640
         'decimal',
1641 1641
         'numeric'
1642
-      ),
1643
-      'blob' => array(
1642
+        ),
1643
+        'blob' => array(
1644 1644
         'tinyblob',
1645 1645
         'blob',
1646 1646
         'mediumblob',
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
         'multilinestring',
1657 1657
         'multipolygon',
1658 1658
         'geometrycollection',
1659
-      )
1659
+        )
1660 1660
     );
1661 1661
 
1662 1662
     public function databases()
@@ -1675,9 +1675,9 @@  discard block
 block discarded – undo
1675 1675
         $ret = "";
1676 1676
 
1677 1677
         $ret .= "CREATE DATABASE /*!32312 IF NOT EXISTS*/ `${databaseName}`".
1678
-          " /*!40100 DEFAULT CHARACTER SET ${characterSet} ".
1679
-          " COLLATE ${collationDb} */;".PHP_EOL.PHP_EOL.
1680
-          "USE `${databaseName}`;".PHP_EOL.PHP_EOL;
1678
+            " /*!40100 DEFAULT CHARACTER SET ${characterSet} ".
1679
+            " COLLATE ${collationDb} */;".PHP_EOL.PHP_EOL.
1680
+            "USE `${databaseName}`;".PHP_EOL.PHP_EOL;
1681 1681
 
1682 1682
         return $ret;
1683 1683
     }
@@ -1720,10 +1720,10 @@  discard block
 block discarded – undo
1720 1720
         }
1721 1721
 
1722 1722
         $ret = "/*!40101 SET @saved_cs_client     = @@character_set_client */;".PHP_EOL.
1723
-          "/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL.
1724
-          $createTable.";".PHP_EOL.
1725
-          "/*!40101 SET character_set_client = @saved_cs_client */;".PHP_EOL.
1726
-          PHP_EOL;
1723
+            "/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL.
1724
+            $createTable.";".PHP_EOL.
1725
+            "/*!40101 SET character_set_client = @saved_cs_client */;".PHP_EOL.
1726
+            PHP_EOL;
1727 1727
         return $ret;
1728 1728
     }
1729 1729
 
@@ -1739,11 +1739,11 @@  discard block
 block discarded – undo
1739 1739
         $definerStr = $this->dumpSettings['skip-definer'] ? '' : '/*!50013 \2 */'.PHP_EOL;
1740 1740
 
1741 1741
         if ($viewStmtReplaced = preg_replace(
1742
-          '/^(CREATE(?:\s+ALGORITHM=(?:UNDEFINED|MERGE|TEMPTABLE))?)\s+('
1743
-          .self::DEFINER_RE.'(?:\s+SQL SECURITY DEFINER|INVOKER)?)?\s+(VIEW .+)$/',
1744
-          '/*!50001 \1 */'.PHP_EOL.$definerStr.'/*!50001 \3 */',
1745
-          $viewStmt,
1746
-          1
1742
+            '/^(CREATE(?:\s+ALGORITHM=(?:UNDEFINED|MERGE|TEMPTABLE))?)\s+('
1743
+            .self::DEFINER_RE.'(?:\s+SQL SECURITY DEFINER|INVOKER)?)?\s+(VIEW .+)$/',
1744
+            '/*!50001 \1 */'.PHP_EOL.$definerStr.'/*!50001 \3 */',
1745
+            $viewStmt,
1746
+            1
1747 1747
         )) {
1748 1748
             $viewStmt = $viewStmtReplaced;
1749 1749
         };
@@ -1762,17 +1762,17 @@  discard block
 block discarded – undo
1762 1762
         $triggerStmt = $row['SQL Original Statement'];
1763 1763
         $definerStr = $this->dumpSettings['skip-definer'] ? '' : '/*!50017 \2*/ ';
1764 1764
         if ($triggerStmtReplaced = preg_replace(
1765
-          '/^(CREATE)\s+('.self::DEFINER_RE.')?\s+(TRIGGER\s.*)$/s',
1766
-          '/*!50003 \1*/ '.$definerStr.'/*!50003 \3 */',
1767
-          $triggerStmt,
1768
-          1
1765
+            '/^(CREATE)\s+('.self::DEFINER_RE.')?\s+(TRIGGER\s.*)$/s',
1766
+            '/*!50003 \1*/ '.$definerStr.'/*!50003 \3 */',
1767
+            $triggerStmt,
1768
+            1
1769 1769
         )) {
1770 1770
             $triggerStmt = $triggerStmtReplaced;
1771 1771
         }
1772 1772
 
1773 1773
         $ret .= "DELIMITER ;;".PHP_EOL.
1774
-          $triggerStmt.";;".PHP_EOL.
1775
-          "DELIMITER ;".PHP_EOL.PHP_EOL;
1774
+            $triggerStmt.";;".PHP_EOL.
1775
+            "DELIMITER ;".PHP_EOL.PHP_EOL;
1776 1776
         return $ret;
1777 1777
     }
1778 1778
 
@@ -1781,18 +1781,18 @@  discard block
 block discarded – undo
1781 1781
         $ret = "";
1782 1782
         if (!isset($row['Create Procedure'])) {
1783 1783
             throw new Exception("Error getting procedure code, unknown output. ".
1784
-              "Please check 'https://bugs.mysql.com/bug.php?id=14564'");
1784
+                "Please check 'https://bugs.mysql.com/bug.php?id=14564'");
1785 1785
         }
1786 1786
         $procedureStmt = $row['Create Procedure'];
1787 1787
 
1788 1788
         $ret .= "/*!50003 DROP PROCEDURE IF EXISTS `".
1789
-          $row['Procedure']."` */;".PHP_EOL.
1790
-          "/*!40101 SET @saved_cs_client     = @@character_set_client */;".PHP_EOL.
1791
-          "/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL.
1792
-          "DELIMITER ;;".PHP_EOL.
1793
-          $procedureStmt." ;;".PHP_EOL.
1794
-          "DELIMITER ;".PHP_EOL.
1795
-          "/*!40101 SET character_set_client = @saved_cs_client */;".PHP_EOL.PHP_EOL;
1789
+            $row['Procedure']."` */;".PHP_EOL.
1790
+            "/*!40101 SET @saved_cs_client     = @@character_set_client */;".PHP_EOL.
1791
+            "/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL.
1792
+            "DELIMITER ;;".PHP_EOL.
1793
+            $procedureStmt." ;;".PHP_EOL.
1794
+            "DELIMITER ;".PHP_EOL.
1795
+            "/*!40101 SET character_set_client = @saved_cs_client */;".PHP_EOL.PHP_EOL;
1796 1796
 
1797 1797
         return $ret;
1798 1798
     }
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
         $ret = "";
1803 1803
         if (!isset($row['Create Event'])) {
1804 1804
             throw new Exception("Error getting event code, unknown output. ".
1805
-              "Please check 'http://stackoverflow.com/questions/10853826/mysql-5-5-create-event-gives-syntax-error'");
1805
+                "Please check 'http://stackoverflow.com/questions/10853826/mysql-5-5-create-event-gives-syntax-error'");
1806 1806
         }
1807 1807
         $eventName = $row['Event'];
1808 1808
         $eventStmt = $row['Create Event'];
@@ -1810,35 +1810,35 @@  discard block
 block discarded – undo
1810 1810
         $definerStr = $this->dumpSettings['skip-definer'] ? '' : '/*!50117 \2*/ ';
1811 1811
 
1812 1812
         if ($eventStmtReplaced = preg_replace(
1813
-          '/^(CREATE)\s+('.self::DEFINER_RE.')?\s+(EVENT .*)$/',
1814
-          '/*!50106 \1*/ '.$definerStr.'/*!50106 \3 */',
1815
-          $eventStmt,
1816
-          1
1813
+            '/^(CREATE)\s+('.self::DEFINER_RE.')?\s+(EVENT .*)$/',
1814
+            '/*!50106 \1*/ '.$definerStr.'/*!50106 \3 */',
1815
+            $eventStmt,
1816
+            1
1817 1817
         )) {
1818 1818
             $eventStmt = $eventStmtReplaced;
1819 1819
         }
1820 1820
 
1821 1821
         $ret .= "/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;".PHP_EOL.
1822
-          "/*!50106 DROP EVENT IF EXISTS `".$eventName."` */;".PHP_EOL.
1823
-          "DELIMITER ;;".PHP_EOL.
1824
-          "/*!50003 SET @saved_cs_client      = @@character_set_client */ ;;".PHP_EOL.
1825
-          "/*!50003 SET @saved_cs_results     = @@character_set_results */ ;;".PHP_EOL.
1826
-          "/*!50003 SET @saved_col_connection = @@collation_connection */ ;;".PHP_EOL.
1827
-          "/*!50003 SET character_set_client  = utf8 */ ;;".PHP_EOL.
1828
-          "/*!50003 SET character_set_results = utf8 */ ;;".PHP_EOL.
1829
-          "/*!50003 SET collation_connection  = utf8_general_ci */ ;;".PHP_EOL.
1830
-          "/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;;".PHP_EOL.
1831
-          "/*!50003 SET sql_mode              = '".$sqlMode."' */ ;;".PHP_EOL.
1832
-          "/*!50003 SET @saved_time_zone      = @@time_zone */ ;;".PHP_EOL.
1833
-          "/*!50003 SET time_zone             = 'SYSTEM' */ ;;".PHP_EOL.
1834
-          $eventStmt." ;;".PHP_EOL.
1835
-          "/*!50003 SET time_zone             = @saved_time_zone */ ;;".PHP_EOL.
1836
-          "/*!50003 SET sql_mode              = @saved_sql_mode */ ;;".PHP_EOL.
1837
-          "/*!50003 SET character_set_client  = @saved_cs_client */ ;;".PHP_EOL.
1838
-          "/*!50003 SET character_set_results = @saved_cs_results */ ;;".PHP_EOL.
1839
-          "/*!50003 SET collation_connection  = @saved_col_connection */ ;;".PHP_EOL.
1840
-          "DELIMITER ;".PHP_EOL.
1841
-          "/*!50106 SET TIME_ZONE= @save_time_zone */ ;".PHP_EOL.PHP_EOL;
1822
+            "/*!50106 DROP EVENT IF EXISTS `".$eventName."` */;".PHP_EOL.
1823
+            "DELIMITER ;;".PHP_EOL.
1824
+            "/*!50003 SET @saved_cs_client      = @@character_set_client */ ;;".PHP_EOL.
1825
+            "/*!50003 SET @saved_cs_results     = @@character_set_results */ ;;".PHP_EOL.
1826
+            "/*!50003 SET @saved_col_connection = @@collation_connection */ ;;".PHP_EOL.
1827
+            "/*!50003 SET character_set_client  = utf8 */ ;;".PHP_EOL.
1828
+            "/*!50003 SET character_set_results = utf8 */ ;;".PHP_EOL.
1829
+            "/*!50003 SET collation_connection  = utf8_general_ci */ ;;".PHP_EOL.
1830
+            "/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;;".PHP_EOL.
1831
+            "/*!50003 SET sql_mode              = '".$sqlMode."' */ ;;".PHP_EOL.
1832
+            "/*!50003 SET @saved_time_zone      = @@time_zone */ ;;".PHP_EOL.
1833
+            "/*!50003 SET time_zone             = 'SYSTEM' */ ;;".PHP_EOL.
1834
+            $eventStmt." ;;".PHP_EOL.
1835
+            "/*!50003 SET time_zone             = @saved_time_zone */ ;;".PHP_EOL.
1836
+            "/*!50003 SET sql_mode              = @saved_sql_mode */ ;;".PHP_EOL.
1837
+            "/*!50003 SET character_set_client  = @saved_cs_client */ ;;".PHP_EOL.
1838
+            "/*!50003 SET character_set_results = @saved_cs_results */ ;;".PHP_EOL.
1839
+            "/*!50003 SET collation_connection  = @saved_col_connection */ ;;".PHP_EOL.
1840
+            "DELIMITER ;".PHP_EOL.
1841
+            "/*!50106 SET TIME_ZONE= @save_time_zone */ ;".PHP_EOL.PHP_EOL;
1842 1842
         // Commented because we are doing this in restore_parameters()
1843 1843
         // "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;" . PHP_EOL . PHP_EOL;
1844 1844
 
@@ -1850,8 +1850,8 @@  discard block
 block discarded – undo
1850 1850
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
1851 1851
         $args = func_get_args();
1852 1852
         return "SELECT TABLE_NAME AS tbl_name ".
1853
-          "FROM INFORMATION_SCHEMA.TABLES ".
1854
-          "WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='${args[0]}'";
1853
+            "FROM INFORMATION_SCHEMA.TABLES ".
1854
+            "WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='${args[0]}'";
1855 1855
     }
1856 1856
 
1857 1857
     public function show_views()
@@ -1859,8 +1859,8 @@  discard block
 block discarded – undo
1859 1859
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
1860 1860
         $args = func_get_args();
1861 1861
         return "SELECT TABLE_NAME AS tbl_name ".
1862
-          "FROM INFORMATION_SCHEMA.TABLES ".
1863
-          "WHERE TABLE_TYPE='VIEW' AND TABLE_SCHEMA='${args[0]}'";
1862
+            "FROM INFORMATION_SCHEMA.TABLES ".
1863
+            "WHERE TABLE_TYPE='VIEW' AND TABLE_SCHEMA='${args[0]}'";
1864 1864
     }
1865 1865
 
1866 1866
     public function show_triggers()
@@ -1882,8 +1882,8 @@  discard block
 block discarded – undo
1882 1882
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
1883 1883
         $args = func_get_args();
1884 1884
         return "SELECT SPECIFIC_NAME AS procedure_name ".
1885
-          "FROM INFORMATION_SCHEMA.ROUTINES ".
1886
-          "WHERE ROUTINE_TYPE='PROCEDURE' AND ROUTINE_SCHEMA='${args[0]}'";
1885
+            "FROM INFORMATION_SCHEMA.ROUTINES ".
1886
+            "WHERE ROUTINE_TYPE='PROCEDURE' AND ROUTINE_SCHEMA='${args[0]}'";
1887 1887
     }
1888 1888
 
1889 1889
     /**
@@ -1897,8 +1897,8 @@  discard block
 block discarded – undo
1897 1897
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
1898 1898
         $args = func_get_args();
1899 1899
         return "SELECT EVENT_NAME AS event_name ".
1900
-          "FROM INFORMATION_SCHEMA.EVENTS ".
1901
-          "WHERE EVENT_SCHEMA='${args[0]}'";
1900
+            "FROM INFORMATION_SCHEMA.EVENTS ".
1901
+            "WHERE EVENT_SCHEMA='${args[0]}'";
1902 1902
     }
1903 1903
 
1904 1904
     public function setup_transaction()
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
1946 1946
         $args = func_get_args();
1947 1947
         return "/*!40000 ALTER TABLE `${args[0]}` DISABLE KEYS */;".
1948
-          PHP_EOL;
1948
+            PHP_EOL;
1949 1949
     }
1950 1950
 
1951 1951
     public function end_add_disable_keys()
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
1954 1954
         $args = func_get_args();
1955 1955
         return "/*!40000 ALTER TABLE `${args[0]}` ENABLE KEYS */;".
1956
-          PHP_EOL;
1956
+            PHP_EOL;
1957 1957
     }
1958 1958
 
1959 1959
     public function start_disable_autocommit()
@@ -1971,7 +1971,7 @@  discard block
 block discarded – undo
1971 1971
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
1972 1972
         $args = func_get_args();
1973 1973
         return "/*!40000 DROP DATABASE IF EXISTS `${args[0]}`*/;".
1974
-          PHP_EOL.PHP_EOL;
1974
+            PHP_EOL.PHP_EOL;
1975 1975
     }
1976 1976
 
1977 1977
     public function add_drop_trigger()
@@ -1993,7 +1993,7 @@  discard block
 block discarded – undo
1993 1993
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
1994 1994
         $args = func_get_args();
1995 1995
         return "DROP TABLE IF EXISTS `${args[0]}`;".PHP_EOL.
1996
-          "/*!50001 DROP VIEW IF EXISTS `${args[0]}`*/;".PHP_EOL;
1996
+            "/*!50001 DROP VIEW IF EXISTS `${args[0]}`*/;".PHP_EOL;
1997 1997
     }
1998 1998
 
1999 1999
     public function getDatabaseHeader()
@@ -2001,8 +2001,8 @@  discard block
 block discarded – undo
2001 2001
         $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
2002 2002
         $args = func_get_args();
2003 2003
         return "--".PHP_EOL.
2004
-          "-- Current Database: `${args[0]}`".PHP_EOL.
2005
-          "--".PHP_EOL.PHP_EOL;
2004
+            "-- Current Database: `${args[0]}`".PHP_EOL.
2005
+            "--".PHP_EOL.PHP_EOL;
2006 2006
     }
2007 2007
 
2008 2008
     /**
@@ -2037,19 +2037,19 @@  discard block
 block discarded – undo
2037 2037
     public function backup_parameters()
2038 2038
     {
2039 2039
         $ret = "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;".PHP_EOL.
2040
-          "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;".PHP_EOL.
2041
-          "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;".PHP_EOL.
2042
-          "/*!40101 SET NAMES ".$this->dumpSettings['default-character-set']." */;".PHP_EOL;
2040
+            "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;".PHP_EOL.
2041
+            "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;".PHP_EOL.
2042
+            "/*!40101 SET NAMES ".$this->dumpSettings['default-character-set']." */;".PHP_EOL;
2043 2043
 
2044 2044
         if (false === $this->dumpSettings['skip-tz-utc']) {
2045 2045
             $ret .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;".PHP_EOL.
2046
-              "/*!40103 SET TIME_ZONE='+00:00' */;".PHP_EOL;
2046
+                "/*!40103 SET TIME_ZONE='+00:00' */;".PHP_EOL;
2047 2047
         }
2048 2048
 
2049 2049
         $ret .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;".PHP_EOL.
2050
-          "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;".PHP_EOL.
2051
-          "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;".PHP_EOL.
2052
-          "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;".PHP_EOL.PHP_EOL;
2050
+            "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;".PHP_EOL.
2051
+            "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;".PHP_EOL.
2052
+            "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;".PHP_EOL.PHP_EOL;
2053 2053
 
2054 2054
         return $ret;
2055 2055
     }
@@ -2063,12 +2063,12 @@  discard block
 block discarded – undo
2063 2063
         }
2064 2064
 
2065 2065
         $ret .= "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;".PHP_EOL.
2066
-          "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;".PHP_EOL.
2067
-          "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;".PHP_EOL.
2068
-          "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;".PHP_EOL.
2069
-          "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;".PHP_EOL.
2070
-          "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;".PHP_EOL.
2071
-          "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;".PHP_EOL.PHP_EOL;
2066
+            "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;".PHP_EOL.
2067
+            "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;".PHP_EOL.
2068
+            "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;".PHP_EOL.
2069
+            "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;".PHP_EOL.
2070
+            "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;".PHP_EOL.
2071
+            "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;".PHP_EOL.PHP_EOL;
2072 2072
 
2073 2073
         return $ret;
2074 2074
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
      */
957 957
     protected function hookTransformColumnValue($tableName, $colName, $colValue, $row)
958 958
     {
959
-        if (! $this->transformColumnValueCallable) {
959
+        if (!$this->transformColumnValueCallable) {
960 960
             return $colValue;
961 961
         }
962 962
 
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
      */
978 978
     protected function hookTransformTableName($tableName, $row = FALSE, $reset = FALSE)
979 979
     {
980
-        if (! $this->transformTableNameCallable) {
980
+        if (!$this->transformTableNameCallable) {
981 981
             if ($row) {
982 982
                 return $row;
983 983
             }
Please login to merge, or discard this patch.