Passed
Push — main ( 598588...6b0a6d )
by Thierry
02:06
created
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, -7 removed lines patch added patch discarded remove patch
@@ -128,12 +128,8 @@  discard block
 block discarded – undo
128 128
             // }
129 129
             $value = ($row !== null ?
130 130
                 ($row[$name] != "" && $this->driver->jush() == "sql" && preg_match("~enum|set~", $field->type) ?
131
-                    (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) :
132
-                    (is_bool($row[$name]) ? +$row[$name] : $row[$name])) :
133
-                (!$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default)));
134
-            $function = ($queryOptions["save"] ? (string)$queryOptions["function"][$name] :
135
-                ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" :
136
-                    ($value === false ? null : ($value !== null ? '' : 'NULL'))));
131
+                    (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)));
132
+            $function = ($queryOptions["save"] ? (string) $queryOptions["function"][$name] : ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL'))));
137 133
             if (!$update && $value == $field->default && preg_match('~^[\w.]+\(~', $value)) {
138 134
                 $function = "SQL";
139 135
             }
@@ -224,7 +220,7 @@  discard block
 block discarded – undo
224 220
      */
225 221
     public function insertItem(string $table, array $queryOptions): array
226 222
     {
227
-        list($fields, ,) = $this->getFields($table, $queryOptions);
223
+        list($fields,,) = $this->getFields($table, $queryOptions);
228 224
 
229 225
         // From edit.inc.php
230 226
         $values = [];
Please login to merge, or discard this patch.
templates/views/bootstrap4/table/query.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <form id="<?php echo $this->formId ?>">
2
-<?php foreach($this->fields as $name => $field): ?>
2
+<?php foreach ($this->fields as $name => $field): ?>
3 3
         <div class="form-group row">
4 4
             <div class="col-md-3">
5 5
                 <label title="<?php echo $field['type'] ?>"><?php echo $field['name'] ?></label>
6 6
             </div>
7 7
             <div class="col-md-2">
8
-<?php if($field['functions']['type'] === 'name'): ?>
8
+<?php if ($field['functions']['type'] === 'name'): ?>
9 9
                 <label class=""><?php echo $field['functions']['name'] ?></label>
10
-<?php elseif($field['functions']['type'] === 'select'): ?>
10
+<?php elseif ($field['functions']['type'] === 'select'): ?>
11 11
                 <select name="<?php echo $field['functions']['name'] ?>" class="form-control">
12
-<?php foreach($field['functions']['options'] as $function): ?>
13
-                    <option <?php if($function === $field['functions']['selected']): ?>selected<?php
12
+<?php foreach ($field['functions']['options'] as $function): ?>
13
+                    <option <?php if ($function === $field['functions']['selected']): ?>selected<?php
14 14
                         endif ?>><?php echo $function ?></option>
15 15
 <?php endforeach ?>
16 16
                 </select>
Please login to merge, or discard this patch.
templates/views/bootstrap3/table/query.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <form class="form-horizontal" role="form" id="<?php echo $this->formId ?>">
2
-<?php foreach($this->fields as $name => $field): ?>
2
+<?php foreach ($this->fields as $name => $field): ?>
3 3
         <div class="form-group">
4 4
             <div class="col-md-3">
5 5
                 <label title="<?php echo $field['type'] ?>"><?php echo $field['name'] ?></label>
6 6
             </div>
7 7
             <div class="col-md-2">
8
-<?php if($field['functions']['type'] === 'name'): ?>
8
+<?php if ($field['functions']['type'] === 'name'): ?>
9 9
                 <label class=""><?php echo $field['functions']['name'] ?></label>
10
-<?php elseif($field['functions']['type'] === 'select'): ?>
10
+<?php elseif ($field['functions']['type'] === 'select'): ?>
11 11
                 <select name="<?php echo $field['functions']['name'] ?>" class="form-control">
12
-<?php foreach($field['functions']['options'] as $function): ?>
13
-                    <option <?php if($function === $field['functions']['selected']): ?>selected<?php
12
+<?php foreach ($field['functions']['options'] as $function): ?>
13
+                    <option <?php if ($function === $field['functions']['selected']): ?>selected<?php
14 14
                         endif ?>><?php echo $function ?></option>
15 15
 <?php endforeach ?>
16 16
                 </select>
Please login to merge, or discard this patch.
src/DbAdmin/Traits/QueryInputTrait.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                 'text' => '<i>' . $this->trans->lang('original') . '</i>'];
70 70
         }
71 71
         if ($field->null) {
72
-            $values[] =  ['value' => '', 'checked' => $value === null && !$select, 'text' => '<i>NULL</i>'];
72
+            $values[] = ['value' => '', 'checked' => $value === null && !$select, 'text' => '<i>NULL</i>'];
73 73
         }
74 74
 
75 75
         // From functions.inc.php (function enum_input())
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
         preg_match_all("~'((?:[^']|'')*)'~", $field->fullType, $matches);
81 81
         foreach ($matches[1] as $i => $val) {
82 82
             $val = stripcslashes(str_replace("''", "'", $val));
83
-            $checked = (is_int($value) ? $value == $i + 1 :
84
-                (is_array($value) ? in_array($i+1, $value) : $value === $val));
83
+            $checked = (is_int($value) ? $value == $i + 1 : (is_array($value) ? in_array($i + 1, $value) : $value === $val));
85 84
             $values[] = ['value' => $i + 1, 'checked' => $checked, 'text' => $this->util->html($val)];
86 85
         }
87 86
 
Please login to merge, or discard this patch.