Passed
Push — main ( cd781c...d64c56 )
by Thierry
02:13
created
src/DbAdmin/CommandAdmin.php 2 patches
Spacing   +5 added lines, -9 removed lines patch added patch discarded remove patch
@@ -96,8 +96,7 @@  discard block
 block discarded – undo
96 96
         if ($rowCount > 0) {
97 97
             $numRows = $statement->rowCount();
98 98
             $message = ($numRows ? ($limit && $numRows > $limit ?
99
-                $this->trans->lang('%d / ', $limit) :
100
-                "") . $this->trans->lang('%d row(s)', $numRows) : "");
99
+                $this->trans->lang('%d / ', $limit) : "") . $this->trans->lang('%d row(s)', $numRows) : "");
101 100
         }
102 101
 
103 102
         // Table header
@@ -158,7 +157,7 @@  discard block
 block discarded – undo
158 157
                 \ini_set("memory_limit", \max($this->util->iniBytes("memory_limit"),
159 158
                     2 * \strlen($queries) + \memory_get_usage() + 8e6));
160 159
             }
161
-            catch(\Exception $e) {
160
+            catch (\Exception $e) {
162 161
                 // Do nothing if the option is not modified.
163 162
             }
164 163
         }
@@ -182,9 +181,7 @@  discard block
 block discarded – undo
182 181
         $timestamps = [];
183 182
         // TODO: Move this to driver implementations
184 183
         $parse = '[\'"' .
185
-            ($this->driver->jush() == "sql" ? '`#' :
186
-            ($this->driver->jush() == "sqlite" ? '`[' :
187
-            ($this->driver->jush() == "mssql" ? '[' : ''))) . ']|/\*|-- |$' .
184
+            ($this->driver->jush() == "sql" ? '`#' : ($this->driver->jush() == "sqlite" ? '`[' : ($this->driver->jush() == "mssql" ? '[' : ''))) . ']|/\*|-- |$' .
188 185
             ($this->driver->jush() == "pgsql" ? '|\$[^$]*\$' : '');
189 186
         // $total_start = \microtime(true);
190 187
         // \parse_str($_COOKIE["adminer_export"], $adminer_export);
@@ -211,8 +208,7 @@  discard block
 block discarded – undo
211 208
 
212 209
             if ($found && \rtrim($found) != $delimiter) {
213 210
                 // find matching quote or comment end
214
-                while (\preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' :
215
-                    (\preg_match('~^-- |^#~', $found) ? "\n" : \preg_quote($found) .
211
+                while (\preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' : (\preg_match('~^-- |^#~', $found) ? "\n" : \preg_quote($found) .
216 212
                     "|\\\\."))) . '|$)s', $queries, $match, PREG_OFFSET_CAPTURE, $offset)) {
217 213
                     //! respect sql_mode NO_BACKSLASH_ESCAPES
218 214
                     $s = $match[0][0];
@@ -306,7 +302,7 @@  discard block
 block discarded – undo
306 302
         if ($empty) {
307 303
             $messages[] = $this->trans->lang('No commands to execute.');
308 304
         } elseif ($onlyErrors) {
309
-            $messages[] =  $this->trans->lang('%d query(s) executed OK.', $commands - \count($errors));
305
+            $messages[] = $this->trans->lang('%d query(s) executed OK.', $commands - \count($errors));
310 306
             // $timestamps[] = $this->trans->formatTime($total_start);
311 307
         }
312 308
         // elseif($errors && $commands > 1)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,8 +157,7 @@
 block discarded – undo
157 157
             try {
158 158
                 \ini_set("memory_limit", \max($this->util->iniBytes("memory_limit"),
159 159
                     2 * \strlen($queries) + \memory_get_usage() + 8e6));
160
-            }
161
-            catch(\Exception $e) {
160
+            } catch(\Exception $e) {
162 161
                 // Do nothing if the option is not modified.
163 162
             }
164 163
         }
Please login to merge, or discard this patch.
src/DbAdmin/ExportAdmin.php 2 patches
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -239,8 +239,7 @@  discard block
 block discarded – undo
239 239
                 $row[$key] = '"' . \str_replace('"', '""', $val) . '"';
240 240
             }
241 241
         }
242
-        $separator = $this->options['format'] == 'csv' ? ',' :
243
-            ($this->options['format'] == 'tsv' ? "\t" : ';');
242
+        $separator = $this->options['format'] == 'csv' ? ',' : ($this->options['format'] == 'tsv' ? "\t" : ';');
244 243
         $this->queries[] = \implode($separator, $row);
245 244
     }
246 245
 
@@ -354,7 +353,7 @@  discard block
 block discarded – undo
354 353
                     } else {
355 354
                         if (!$insert) {
356 355
                             $insert = 'INSERT INTO ' . $this->driver->table($table) . ' (' .
357
-                                \implode(', ', \array_map(function ($key) {
356
+                                \implode(', ', \array_map(function($key) {
358 357
                                     return $this->driver->escapeId($key);
359 358
                                 }, $keys)) . ') VALUES';
360 359
                         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -526,8 +526,7 @@
 block discarded – undo
526 526
                 }
527 527
 
528 528
                 $this->dumpTablesAndViews($database);
529
-            }
530
-            catch (\Exception $e) {
529
+            } catch (\Exception $e) {
531 530
                 return $e->getMessage();
532 531
             }
533 532
         }
Please login to merge, or discard this patch.
src/DbAdmin/TableQueryAdmin.php 1 patch
Spacing   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
             $maxlength = (!\preg_match('~int~', $field->type) &&
102 102
                 \preg_match('~^(\d+)(,(\d+))?$~', $field->length, $match) ?
103 103
                 ((\preg_match("~binary~", $field->type) ? 2 : 1) * $match[1] + (($match[3] ?? null) ? 1 : 0) +
104
-                (($match[2] ?? false) && !$unsigned ? 1 : 0)) :
105
-                ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0));
104
+                (($match[2] ?? false) && !$unsigned ? 1 : 0)) : ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0));
106 105
             if ($this->driver->jush() == 'sql' && $this->driver->minVersion(5.6) && \preg_match('~time~', $field->type)) {
107 106
                 $maxlength += 7; // microtime
108 107
             }
@@ -243,8 +242,7 @@  discard block
 block discarded – undo
243 242
                 $value = (
244 243
                     $row !== null ? (
245 244
                         $row[$name] != "" && $this->driver->jush() == "sql" && \preg_match("~enum|set~", $field->type) ?
246
-                        (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) :
247
-                        (\is_bool($row[$name]) ? +$row[$name] : $row[$name])
245
+                        (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : (\is_bool($row[$name]) ? +$row[$name] : $row[$name])
248 246
                     ) : (
249 247
                         !$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default)
250 248
                     )
@@ -254,7 +252,7 @@  discard block
 block discarded – undo
254 252
                 }
255 253
                 $function = (
256 254
                     $queryOptions["save"]
257
-                    ? (string)$queryOptions["function"][$name]
255
+                    ? (string) $queryOptions["function"][$name]
258 256
                     : (
259 257
                         $update && \preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate)
260 258
                         ? "now"
Please login to merge, or discard this patch.