Passed
Push — main ( 08974e...644444 )
by Thierry
02:28
created
src/Driver/Facades/QueryFacade.php 1 patch
Spacing   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
         // From edit.inc.php
64 64
         $fields = $this->driver->fields($table);
65 65
         // Important: get the where clauses before filtering the fields.
66
-        $where = $this->operation === 'insert' ? [] :
67
-            $this->driver->where($options, $fields);
66
+        $where = $this->operation === 'insert' ? [] : $this->driver->where($options, $fields);
68 67
         // Remove fields without the required privilege, or that cannot be edited.
69 68
         $fields = array_filter($fields, fn(TableFieldEntity $field) =>
70 69
             isset($field->privileges[$this->operation]) &&
@@ -86,7 +85,7 @@  discard block
 block discarded – undo
86 85
         $this->action = 'read';
87 86
         $this->operation = 'insert';
88 87
 
89
-        [$fields,] = $this->getFields($table, $options);
88
+        [$fields, ] = $this->getFields($table, $options);
90 89
         if (empty($fields)) {
91 90
             return [
92 91
                 'error' => $this->utils->trans->lang('You have no privileges to update this table.'),
@@ -114,8 +113,7 @@  discard block
 block discarded – undo
114 113
         $select = [];
115 114
         foreach ($fields as $name => $field) {
116 115
             if (isset($field->privileges["select"])) {
117
-                $as = $this->action === 'clone' && $field->autoIncrement ? "''" :
118
-                    $this->driver->convertField($field);
116
+                $as = $this->action === 'clone' && $field->autoIncrement ? "''" : $this->driver->convertField($field);
119 117
                 $select[] = ($as ? "$as AS " : "") . $this->driver->escapeId($name);
120 118
             }
121 119
         }
@@ -160,7 +158,7 @@  discard block
 block discarded – undo
160 158
         }
161 159
 
162 160
         $rowData = $statement->fetchAssoc();
163
-        if($this->action === 'select' && (!$rowData || $statement->fetchAssoc()))
161
+        if ($this->action === 'select' && (!$rowData || $statement->fetchAssoc()))
164 162
         {
165 163
             // $statement->rowCount() != 1 isn't available in all drivers
166 164
             return [
@@ -187,7 +185,7 @@  discard block
 block discarded – undo
187 185
         $this->action = 'save';
188 186
         $this->operation = 'insert';
189 187
 
190
-        [$fields,] = $this->getFields($table, $options);
188
+        [$fields, ] = $this->getFields($table, $options);
191 189
         $values = $this->reader()->getInputValues($fields, $values);
192 190
 
193 191
         $query = $this->driver->getInsertQuery($table, $values);
@@ -210,7 +208,7 @@  discard block
 block discarded – undo
210 208
         $this->action = 'save';
211 209
         $this->operation = 'insert';
212 210
 
213
-        [$fields,] = $this->getFields($table, $options);
211
+        [$fields, ] = $this->getFields($table, $options);
214 212
         $values = $this->reader()->getInputValues($fields, $values);
215 213
 
216 214
         if (!$this->driver->insert($table, $values)) {
Please login to merge, or discard this patch.
src/Page/Dml/DataFieldInput.php 1 patch
Spacing   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,10 +43,9 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return bool
45 45
      */
46
-    private function isChecked(FieldEditEntity $editField, string $fieldValue, string|null $enumValue): bool
46
+    private function isChecked(FieldEditEntity $editField, string $fieldValue, string | null $enumValue): bool
47 47
     {
48
-        return !is_array($editField->value) ? $editField->value === $enumValue :
49
-            in_array($fieldValue, $editField->value);
48
+        return !is_array($editField->value) ? $editField->value === $enumValue : in_array($fieldValue, $editField->value);
50 49
     }
51 50
 
52 51
     /**
@@ -54,9 +53,9 @@  discard block
 block discarded – undo
54 53
      * 
55 54
      * @param FieldEditEntity $editField
56 55
      */
57
-    private function getItemList(FieldEditEntity $editField, array $attrs, string $default = ""): array|null
56
+    private function getItemList(FieldEditEntity $editField, array $attrs, string $default = ""): array | null
58 57
     {
59
-        if ($editField->type !== 'enum' && $editField->type !== 'set' ) {
58
+        if ($editField->type !== 'enum' && $editField->type !== 'set') {
60 59
             // Only for enums and sets
61 60
             return null;
62 61
         }
@@ -261,8 +260,7 @@  discard block
 block discarded – undo
261 260
             preg_match('~^(\d+)(,(\d+))?$~', $length, $match) ?
262 261
             ((preg_match("~binary~", $type) ? 2 : 1) *
263 262
                 ($match[1] ?? 0) + (($match[3] ?? false) ? 1 : 0) +
264
-                (($match[2] ?? false) && !$unsigned ? 1 : 0)) :
265
-            (isset($types[$type]) ? $types[$type] + ($unsigned ? 0 : 1) : 0)
263
+                (($match[2] ?? false) && !$unsigned ? 1 : 0)) : (isset($types[$type]) ? $types[$type] + ($unsigned ? 0 : 1) : 0)
266 264
         );
267 265
 
268 266
         return $this->driver->jush() === 'sql' &&
@@ -309,7 +307,7 @@  discard block
 block discarded – undo
309 307
      *
310 308
      * @return array
311 309
      */
312
-    private function getFieldValueInput(FieldEditEntity $editField, bool|null $autofocus): array
310
+    private function getFieldValueInput(FieldEditEntity $editField, bool | null $autofocus): array
313 311
     {
314 312
         // From input(array $field, $value, ?string $function, ?bool $autofocus = false) in html.inc.php
315 313
         $attrs = [
@@ -346,7 +344,7 @@  discard block
 block discarded – undo
346 344
      *
347 345
      * @return array|null
348 346
      */
349
-    private function getFieldFunctionInput(FieldEditEntity $editField): array|null
347
+    private function getFieldFunctionInput(FieldEditEntity $editField): array | null
350 348
     {
351 349
         // From html.inc.php: function input(array $field, $value, ?string $function, ?bool $autofocus = false)
352 350
         if ($editField->type === 'enum' || $editField->function === null) {
@@ -378,7 +376,7 @@  discard block
 block discarded – undo
378 376
      *
379 377
      * @return void
380 378
      */
381
-    public function setFieldInputValues(FieldEditEntity $editField, bool|null $autofocus): void
379
+    public function setFieldInputValues(FieldEditEntity $editField, bool | null $autofocus): void
382 380
     {
383 381
         $editField->functionInput = $this->getFieldFunctionInput($editField);
384 382
         $editField->valueInput = $this->getFieldValueInput($editField, $autofocus);
Please login to merge, or discard this patch.