Passed
Push — main ( 0df457...604840 )
by Thierry
01:35
created
src/Db/Database.php 1 patch
Spacing   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             $clauses[] = 'DROP INDEX ' . $this->driver->escapeId($index->name);
78 78
         }
79 79
         foreach ($alter as $index) {
80
-            $clauses[] = 'ADD ' . ($index->type == 'PRIMARY' ? 'PRIMARY KEY ' :  $index->type . ' ') .
80
+            $clauses[] = 'ADD ' . ($index->type == 'PRIMARY' ? 'PRIMARY KEY ' : $index->type . ' ') .
81 81
                 ($index->name != '' ? $this->driver->escapeId($index->name) . ' ' : '') .
82 82
                 '(' . implode(', ', $index->columns) . ')';
83 83
         }
@@ -91,8 +91,7 @@  discard block
 block discarded – undo
91 91
     public function tables()
92 92
     {
93 93
         return $this->driver->keyValues($this->driver->minVersion(5) ?
94
-            'SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME' :
95
-            'SHOW TABLES');
94
+            'SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME' : 'SHOW TABLES');
96 95
     }
97 96
 
98 97
     /**
@@ -112,7 +111,7 @@  discard block
 block discarded – undo
112 111
      */
113 112
     public function dropViews(array $views)
114 113
     {
115
-        $this->driver->execute('DROP VIEW ' . implode(', ', array_map(function ($view) {
114
+        $this->driver->execute('DROP VIEW ' . implode(', ', array_map(function($view) {
116 115
             return $this->driver->table($view);
117 116
         }, $views)));
118 117
         return true;
@@ -123,7 +122,7 @@  discard block
 block discarded – undo
123 122
      */
124 123
     public function dropTables(array $tables)
125 124
     {
126
-        $this->driver->execute('DROP TABLE ' . implode(', ', array_map(function ($table) {
125
+        $this->driver->execute('DROP TABLE ' . implode(', ', array_map(function($table) {
127 126
             return $this->driver->table($table);
128 127
         }, $tables)));
129 128
         return true;
@@ -183,16 +182,14 @@  discard block
 block discarded – undo
183 182
             foreach ($this->driver->rows('SHOW TRIGGERS LIKE ' . $this->driver->quote(addcslashes($table, "%_\\"))) as $row) {
184 183
                 $trigger = $row['Trigger'];
185 184
                 if (!$this->driver->execute('CREATE TRIGGER ' .
186
-                    ($target == $this->driver->database() ? $this->driver->escapeId("copy_$trigger") :
187
-                    $this->driver->escapeId($target) . '.' . $this->driver->escapeId($trigger)) .
185
+                    ($target == $this->driver->database() ? $this->driver->escapeId("copy_$trigger") : $this->driver->escapeId($target) . '.' . $this->driver->escapeId($trigger)) .
188 186
                     " $row[Timing] $row[Event] ON $name FOR EACH ROW\n$row[Statement];")) {
189 187
                     return false;
190 188
                 }
191 189
             }
192 190
         }
193 191
         foreach ($views as $table) {
194
-            $name = ($target == $this->driver->database() ? $this->driver->table("copy_$table") :
195
-                $this->driver->escapeId($target) . '.' . $this->driver->table($table));
192
+            $name = ($target == $this->driver->database() ? $this->driver->table("copy_$table") : $this->driver->escapeId($target) . '.' . $this->driver->table($table));
196 193
             $view = $this->driver->view($table);
197 194
             if (($overwrite && !$this->driver->execute("DROP VIEW IF EXISTS $name"))
198 195
                 || !$this->driver->execute("CREATE VIEW $name AS $view[select]")) { //! USE to avoid db.table
Please login to merge, or discard this patch.