Passed
Push — main ( 0a20e8...37b358 )
by Thierry
02:18
created
src/Package.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     {
202 202
         $servers = $this->getConfig()->getOption('servers', []);
203 203
         $default = $this->getConfig()->getOption('default', '');
204
-        if(array_key_exists($default, $servers))
204
+        if (array_key_exists($default, $servers))
205 205
         {
206 206
             return $default;
207 207
         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      */
257 257
     public function getReadyScript()
258 258
     {
259
-        if(!($server = $this->getDefaultServer()))
259
+        if (!($server = $this->getDefaultServer()))
260 260
         {
261 261
             return '';
262 262
         }
Please login to merge, or discard this patch.
src/Db/Util.php 2 patches
Spacing   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -449,9 +449,8 @@  discard block
 block discarded – undo
449 449
         \preg_match_all("~'((?:[^']|'')*)'~", $field->length, $matches);
450 450
         foreach ($matches[1] as $i => $val) {
451 451
             $val = \stripcslashes(\str_replace("''", "'", $val));
452
-            $checked = (\is_int($value) ? $value == $i + 1 :
453
-                (\is_array($value) ? \in_array($i+1, $value) : $value === $val));
454
-            $inputs[] = "<label><input type='$type'$attrs value='" . ($i+1) . "'" .
452
+            $checked = (\is_int($value) ? $value == $i + 1 : (\is_array($value) ? \in_array($i + 1, $value) : $value === $val));
453
+            $inputs[] = "<label><input type='$type'$attrs value='" . ($i + 1) . "'" .
455 454
                 ($checked ? ' checked' : '') . '>' . $this->html($val) . '</label>';
456 455
         }
457 456
 
@@ -515,8 +514,7 @@  discard block
 block discarded – undo
515 514
         }
516 515
         $enumLength = $this->driver->enumLength();
517 516
         return (\preg_match("~^\\s*\\(?\\s*$enumLength(?:\\s*,\\s*$enumLength)*+\\s*\\)?\\s*\$~", $length) &&
518
-            \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' :
519
-            \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length))
517
+            \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' : \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length))
520 518
         );
521 519
     }
522 520
 
@@ -703,7 +701,7 @@  discard block
 block discarded – undo
703 701
         $expressions = [];
704 702
         foreach ($indexes as $i => $index) {
705 703
             if ($index->type == 'FULLTEXT' && $this->input->values['fulltext'][$i] != '') {
706
-                $columns = \array_map(function ($column) {
704
+                $columns = \array_map(function($column) {
707 705
                     return $this->driver->escapeId($column);
708 706
                 }, $index->columns);
709 707
                 $expressions[] = 'MATCH (' . \implode(', ', $columns) . ') AGAINST (' .
@@ -818,8 +816,7 @@  discard block
 block discarded – undo
818 816
      */
819 817
     private function _selectValue($value, string $link, string $type, $original): string
820 818
     {
821
-        $clause = ($value === null ? '<i>NULL</i>' :
822
-            (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ?
819
+        $clause = ($value === null ? '<i>NULL</i>' : (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ?
823 820
             "<code>$value</code>" : $value));
824 821
         if (\preg_match('~blob|bytea|raw|file~', $type) && !$this->isUtf8($value)) {
825 822
             $clause = '<i>' . $this->trans->lang('%d byte(s)', \strlen($original)) . '</i>';
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -858,8 +858,7 @@
 block discarded – undo
858 858
         if ($link === '') {
859 859
             if ($this->isMail($value)) {
860 860
                 $link = "mailto:$value";
861
-            }
862
-            elseif ($this->isUrl($value)) {
861
+            } elseif ($this->isUrl($value)) {
863 862
                 $link = $value; // IE 11 and all modern browsers hide referrer
864 863
             }
865 864
         }
Please login to merge, or discard this patch.
src/DbAdmin/Traits/TableSelectTrait.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -261,7 +261,7 @@
 block discarded – undo
261 261
      * @return TableSelectEntity
262 262
      */
263 263
     private function getSelectEntity(string $table, array $columns, array $fields, array $select,
264
-                                     array $group, array $where, array $order, array $unselected, int $limit, int $page): TableSelectEntity
264
+                                        array $group, array $where, array $order, array $unselected, int $limit, int $page): TableSelectEntity
265 265
     {
266 266
         $select2 = $select;
267 267
         $group2 = $group;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     {
26 26
         return [
27 27
             'select' => $select,
28
-            'values' => (array)$options["columns"],
28
+            'values' => (array) $options["columns"],
29 29
             'columns' => $columns,
30 30
             'functions' => $this->driver->functions(),
31 31
             'grouping' => $this->driver->grouping(),
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         }
50 50
         return [
51 51
             // 'where' => $where,
52
-            'values' => (array)$options["where"],
52
+            'values' => (array) $options["where"],
53 53
             'columns' => $columns,
54 54
             'indexes' => $indexes,
55 55
             'operators' => $this->driver->operators(),
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
     private function getSortingOptions(array $columns, array $options): array
69 69
     {
70 70
         $values = [];
71
-        $descs = (array)$options["desc"];
72
-        foreach ((array)$options["order"] as $key => $value) {
71
+        $descs = (array) $options["desc"];
72
+        foreach ((array) $options["order"] as $key => $value) {
73 73
             $values[] = [
74 74
                 'col' => $value,
75 75
                 'desc' => $descs[$key] ?? 0,
Please login to merge, or discard this patch.
src/DbAdmin/TableSelectAdmin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -329,8 +329,8 @@
 block discarded – undo
329 329
      */
330 330
     public function execSelect(string $table, array $queryOptions): array
331 331
     {
332
-        list(, $query, $select, $fields, , , $indexes, $where, $group, , $limit, $page,
333
-            $textLength, , $unselected) = $this->prepareSelect($table, $queryOptions);
332
+        list(, $query, $select, $fields,,, $indexes, $where, $group,, $limit, $page,
333
+            $textLength,, $unselected) = $this->prepareSelect($table, $queryOptions);
334 334
 
335 335
         list($rows, $duration) = $this->executeQuery($query, $page);
336 336
         if (!$rows) {
Please login to merge, or discard this patch.
src/DbAdmin/TableAdmin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
                 $target .= '<b>' . $this->util->html($foreignKey->schema) . '</b>.';
219 219
             }
220 220
             $target = $this->util->html($foreignKey->table) .
221
-                '(' . implode(', ', array_map(function ($key) {
221
+                '(' . implode(', ', array_map(function($key) {
222 222
                     return $this->util->html($key);
223 223
                 }, $foreignKey->target)) . ')';
224 224
             $details[] = [
225 225
                 'name' => $this->util->html($name),
226 226
                 'source' => '<i>' . implode(
227 227
                     '</i>, <i>',
228
-                    array_map(function ($key) {
228
+                    array_map(function($key) {
229 229
                         return $this->util->html($key);
230 230
                     }, $foreignKey->source)
231 231
                 ) . '</i>',
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     private function makeTableAttrs(array $values, string $table = '')
370 370
     {
371 371
         // From create.inc.php
372
-        $values['fields'] = (array)$values['fields'];
372
+        $values['fields'] = (array) $values['fields'];
373 373
         if ($values['autoIncrementCol']) {
374 374
             $values['fields'][$values['autoIncrementCol']]['autoIncrement'] = true;
375 375
         }
Please login to merge, or discard this patch.
src/DbAdmin/Traits/TableTrait.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,8 +141,7 @@
 block discarded – undo
141 141
     {
142 142
         $foreignKey = $this->foreignKeys[$field->type] ?? null;
143 143
         //! Can collide with user defined type
144
-        $typeField = ($foreignKey === null ? $field :
145
-            TableFieldEntity::make($this->referencableTables[$foreignKey]));
144
+        $typeField = ($foreignKey === null ? $field : TableFieldEntity::make($this->referencableTables[$foreignKey]));
146 145
         $processedField = $this->util->processField($field, $typeField);
147 146
         $origField = $this->fields[$this->fieldName] ?? null;
148 147
         if ($this->fieldName === '') {
Please login to merge, or discard this patch.
src/DbAdmin/TableQueryAdmin.php 1 patch
Spacing   +3 added lines, -8 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@  discard block
 block discarded – undo
97 97
         $maxlength = (!preg_match('~int~', $field->type) &&
98 98
         preg_match('~^(\d+)(,(\d+))?$~', $field->length, $match) ?
99 99
             ((preg_match("~binary~", $field->type) ? 2 : 1) * $match[1] + (($match[3] ?? null) ? 1 : 0) +
100
-                (($match[2] ?? false) && !$unsigned ? 1 : 0)) :
101
-            ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0));
100
+                (($match[2] ?? false) && !$unsigned ? 1 : 0)) : ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0));
102 101
         if ($this->driver->jush() == 'sql' && $this->driver->minVersion(5.6) && preg_match('~time~', $field->type)) {
103 102
             $maxlength += 7; // microtime
104 103
         }
@@ -333,12 +332,8 @@  discard block
 block discarded – undo
333 332
                 // }
334 333
                 $value = ($row !== null ?
335 334
                     ($row[$name] != "" && $this->driver->jush() == "sql" && preg_match("~enum|set~", $field->type) ?
336
-                    (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) :
337
-                    (is_bool($row[$name]) ? +$row[$name] : $row[$name])) :
338
-                    (!$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default)));
339
-                $function = ($queryOptions["save"] ? (string)$queryOptions["function"][$name] :
340
-                    ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" :
341
-                    ($value === false ? null : ($value !== null ? '' : 'NULL'))));
335
+                    (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) : (is_bool($row[$name]) ? +$row[$name] : $row[$name])) : (!$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default)));
336
+                $function = ($queryOptions["save"] ? (string) $queryOptions["function"][$name] : ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL'))));
342 337
                 if (!$update && $value == $field->default && preg_match('~^[\w.]+\(~', $value)) {
343 338
                     $function = "SQL";
344 339
                 }
Please login to merge, or discard this patch.