Passed
Push — main ( 1926a3...c0ed3d )
by Thierry
02:11
created
src/DbAdmin/TableSelectAdmin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         return [
25 25
             'select' => $select,
26
-            'values' => (array)$options["columns"],
26
+            'values' => (array) $options["columns"],
27 27
             'columns' => $columns,
28 28
             'functions' => $this->driver->functions(),
29 29
             'grouping' => $this->driver->grouping(),
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         }
48 48
         return [
49 49
             // 'where' => $where,
50
-            'values' => (array)$options["where"],
50
+            'values' => (array) $options["where"],
51 51
             'columns' => $columns,
52 52
             'indexes' => $indexes,
53 53
             'operators' => $this->driver->operators(),
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
     private function getSortingOptions(array $columns, array $options)
67 67
     {
68 68
         $values = [];
69
-        $descs = (array)$options["desc"];
70
-        foreach ((array)$options["order"] as $key => $value) {
69
+        $descs = (array) $options["desc"];
70
+        foreach ((array) $options["order"] as $key => $value) {
71 71
             $values[] = [
72 72
                 'col' => $value,
73 73
                 'desc' => $descs[$key] ?? 0,
Please login to merge, or discard this patch.
src/Db/Util.php 2 patches
Spacing   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function html(?string $string)
82 82
     {
83
-        if(!$string) {
83
+        if (!$string) {
84 84
             return $string;
85 85
         }
86 86
         return \str_replace("\0", '�', \htmlspecialchars($string, ENT_QUOTES, 'utf-8'));
@@ -520,9 +520,8 @@  discard block
 block discarded – undo
520 520
         \preg_match_all("~'((?:[^']|'')*)'~", $field->length, $matches);
521 521
         foreach ($matches[1] as $i => $val) {
522 522
             $val = \stripcslashes(\str_replace("''", "'", $val));
523
-            $checked = (\is_int($value) ? $value == $i + 1 :
524
-                (\is_array($value) ? \in_array($i+1, $value) : $value === $val));
525
-            $inputs[] = "<label><input type='$type'$attrs value='" . ($i+1) . "'" .
523
+            $checked = (\is_int($value) ? $value == $i + 1 : (\is_array($value) ? \in_array($i + 1, $value) : $value === $val));
524
+            $inputs[] = "<label><input type='$type'$attrs value='" . ($i + 1) . "'" .
526 525
                 ($checked ? ' checked' : '') . '>' . $this->html($this->editValue($val, $field)) . '</label>';
527 526
         }
528 527
 
@@ -586,8 +585,7 @@  discard block
 block discarded – undo
586 585
         }
587 586
         $enumLength = $this->driver->enumLength();
588 587
         return (\preg_match("~^\\s*\\(?\\s*$enumLength(?:\\s*,\\s*$enumLength)*+\\s*\\)?\\s*\$~", $length) &&
589
-            \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' :
590
-            \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length))
588
+            \preg_match_all("~$enumLength~", $length, $matches) ? '(' . \implode(',', $matches[0]) . ')' : \preg_replace('~^[0-9].*~', '(\0)', \preg_replace('~[^-0-9,+()[\]]~', '', $length))
591 589
         );
592 590
     }
593 591
 
@@ -769,7 +767,7 @@  discard block
 block discarded – undo
769 767
         $expressions = [];
770 768
         foreach ($indexes as $i => $index) {
771 769
             if ($index->type == 'FULLTEXT' && $this->input->values['fulltext'][$i] != '') {
772
-                $columns = \array_map(function ($column) {
770
+                $columns = \array_map(function($column) {
773 771
                     return $this->driver->escapeId($column);
774 772
                 }, $index->columns);
775 773
                 $expressions[] = 'MATCH (' . \implode(', ', $columns) . ') AGAINST (' .
@@ -884,8 +882,7 @@  discard block
 block discarded – undo
884 882
      */
885 883
     private function _selectValue($value, string $link, string $type, string $original)
886 884
     {
887
-        $clause = ($value === null ? '<i>NULL</i>' :
888
-            (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ?
885
+        $clause = ($value === null ? '<i>NULL</i>' : (\preg_match('~char|binary|boolean~', $type) && !\preg_match('~var~', $type) ?
889 886
             "<code>$value</code>" : $value));
890 887
         if (\preg_match('~blob|bytea|raw|file~', $type) && !$this->isUtf8($value)) {
891 888
             $clause = '<i>' . $this->trans->lang('%d byte(s)', \strlen($original)) . '</i>';
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -924,11 +924,9 @@
 block discarded – undo
924 924
         if ($link === '') {
925 925
             if ($this->isMail($value)) {
926 926
                 $link = "mailto:$value";
927
-            }
928
-            elseif ($this->isUrl($value)) {
927
+            } elseif ($this->isUrl($value)) {
929 928
                 $link = $value; // IE 11 and all modern browsers hide referrer
930
-            }
931
-            else {
929
+            } else {
932 930
                 $link = '';
933 931
             }
934 932
         }
Please login to merge, or discard this patch.
src/DbAdmin/CommandAdmin.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -325,8 +325,7 @@
 block discarded – undo
325 325
             try {
326 326
                 \ini_set('memory_limit', \max($this->util->iniBytes('memory_limit'),
327 327
                     2 * \strlen($queries) + \memory_get_usage() + 8e6));
328
-            }
329
-            catch(\Exception $e) {
328
+            } catch(\Exception $e) {
330 329
                 // Do nothing if the option is not modified.
331 330
             }
332 331
         }
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param mixed $value
39 39
      *
40 40
      * @return string
41
-    */
41
+     */
42 42
     // protected function editLink($value)
43 43
     // {
44 44
     //     $link = '';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param array $types
66 66
      *
67 67
      * @return string
68
-    */
68
+     */
69 69
     protected function values(array $row, array $blobs, array $types)
70 70
     {
71 71
         $values = [];
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param int $limit
93 93
      *
94 94
      * @return string
95
-    */
95
+     */
96 96
     private function message($statement, int $limit)
97 97
     {
98 98
         $numRows = $statement->rowCount();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @param array $orgtables
112 112
      *
113 113
      * @return string
114
-    */
114
+     */
115 115
     // protected function indexes($field, array $orgtables)
116 116
     // {
117 117
     //     static $links = []; // colno => orgtable - create links from these columns
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * @param int $limit
149 149
      *
150 150
      * @return array
151
-    */
151
+     */
152 152
     protected function select($statement, $limit = 0)
153 153
     {
154 154
         $blobs = []; // colno => bool - display bytes for blobs
Please login to merge, or discard this patch.
Spacing   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -208,9 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
         // TODO: Move this to driver implementations
210 210
         $parse = '[\'"' .
211
-            ($this->driver->jush() == "sql" ? '`#' :
212
-            ($this->driver->jush() == "sqlite" ? '`[' :
213
-            ($this->driver->jush() == "mssql" ? '[' : ''))) . ']|/\*|-- |$' .
211
+            ($this->driver->jush() == "sql" ? '`#' : ($this->driver->jush() == "sqlite" ? '`[' : ($this->driver->jush() == "mssql" ? '[' : ''))) . ']|/\*|-- |$' .
214 212
             ($this->driver->jush() == "pgsql" ? '|\$[^$]*\$' : '');
215 213
         // should always match
216 214
         \preg_match('(' . \preg_quote($delimiter) . "\\s*|$parse)", $queries, $match, PREG_OFFSET_CAPTURE, $offset);
@@ -223,8 +221,7 @@  discard block
 block discarded – undo
223 221
 
224 222
         if (!empty($found) && \rtrim($found) != $delimiter) {
225 223
             // find matching quote or comment end
226
-            while (\preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' :
227
-                (\preg_match('~^-- |^#~', $found) ? "\n" : \preg_quote($found) . "|\\\\."))) . '|$)s',
224
+            while (\preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' : (\preg_match('~^-- |^#~', $found) ? "\n" : \preg_quote($found) . "|\\\\."))) . '|$)s',
228 225
                 $queries, $match, PREG_OFFSET_CAPTURE, $offset)) {
229 226
                 //! respect sql_mode NO_BACKSLASH_ESCAPES
230 227
                 $s = $match[0][0];
@@ -324,7 +321,7 @@  discard block
 block discarded – undo
324 321
                 \ini_set('memory_limit', \max($this->util->iniBytes('memory_limit'),
325 322
                     2 * \strlen($queries) + \memory_get_usage() + 8e6));
326 323
             }
327
-            catch(\Exception $e) {
324
+            catch (\Exception $e) {
328 325
                 // Do nothing if the option is not modified.
329 326
             }
330 327
         }
@@ -380,7 +377,7 @@  discard block
 block discarded – undo
380 377
         if ($empty) {
381 378
             $messages[] = $this->trans->lang('No commands to execute.');
382 379
         } elseif ($onlyErrors) {
383
-            $messages[] =  $this->trans->lang('%d query(s) executed OK.', $commands - $errors);
380
+            $messages[] = $this->trans->lang('%d query(s) executed OK.', $commands - $errors);
384 381
             // $timestamps[] = $this->trans->formatTime($total_start);
385 382
         }
386 383
 
Please login to merge, or discard this patch.