@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @var SelectQuery|null |
| 31 | 31 | */ |
| 32 | - private SelectQuery|null $selectQuery = null; |
|
| 32 | + private SelectQuery | null $selectQuery = null; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * @var SelectEntity|null |
| 36 | 36 | */ |
| 37 | - private SelectEntity|null $selectEntity = null; |
|
| 37 | + private SelectEntity | null $selectEntity = null; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @param AbstractFacade $dbFacade |
@@ -123,11 +123,9 @@ discard block |
||
| 123 | 123 | $value = $this->selectEntity->queryOptions["columns"][$valueKey] ?? []; |
| 124 | 124 | |
| 125 | 125 | $fun = $value["fun"] ?? ''; |
| 126 | - $fieldKey = !$this->selectEntity->select ? $key : |
|
| 127 | - ($value["col"] ?? current($this->selectEntity->select)); |
|
| 126 | + $fieldKey = !$this->selectEntity->select ? $key : ($value["col"] ?? current($this->selectEntity->select)); |
|
| 128 | 127 | $field = $this->selectEntity->fields[$fieldKey]; |
| 129 | - $name = !$field ? ($fun ? "*" : $key) : |
|
| 130 | - $this->page->fieldName($field, $rank); |
|
| 128 | + $name = !$field ? ($fun ? "*" : $key) : $this->page->fieldName($field, $rank); |
|
| 131 | 129 | |
| 132 | 130 | return [$fun, $name, $field]; |
| 133 | 131 | } |
@@ -253,8 +251,7 @@ discard block |
||
| 253 | 251 | private function getRowIdMd5Key(string $key, string $collation): string |
| 254 | 252 | { |
| 255 | 253 | return $this->driver->jush() != 'sql' || |
| 256 | - preg_match("~^utf8~", $collation) ? $key : |
|
| 257 | - "CONVERT($key USING " . $this->driver->charset() . ")"; |
|
| 254 | + preg_match("~^utf8~", $collation) ? $key : "CONVERT($key USING " . $this->driver->charset() . ")"; |
|
| 258 | 255 | } |
| 259 | 256 | |
| 260 | 257 | /** |
@@ -363,8 +360,8 @@ discard block |
||
| 363 | 360 | $query = $this->driver->getRowCountQuery($table, |
| 364 | 361 | $this->selectEntity->where, $this->hasGroupsInFields(), |
| 365 | 362 | $this->selectEntity->group); |
| 366 | - return (int)$this->driver->result($query); |
|
| 367 | - } catch(Exception) { |
|
| 363 | + return (int) $this->driver->result($query); |
|
| 364 | + } catch (Exception) { |
|
| 368 | 365 | return -1; |
| 369 | 366 | } |
| 370 | 367 | } |
@@ -210,7 +210,7 @@ |
||
| 210 | 210 | $editField->fullType = $this->utils->html($field->fullType); |
| 211 | 211 | |
| 212 | 212 | if (is_array($editField->value) && !$editField->function) { |
| 213 | - // 128 - JSON_PRETTY_PRINT, 64 - JSON_UNESCAPED_SLASHES, 256 - JSON_UNESCAPED_UNICODE available since PHP 5.4 |
|
| 213 | + // 128 - JSON_PRETTY_PRINT, 64 - JSON_UNESCAPED_SLASHES, 256 - JSON_UNESCAPED_UNICODE available since PHP 5.4 |
|
| 214 | 214 | $editField->value = json_encode($editField->value, |
| 215 | 215 | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
| 216 | 216 | $editField->function = 'json'; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return mixed |
| 122 | 122 | */ |
| 123 | - private function getInputValue(TableFieldEntity $field, array|null $rowData): mixed |
|
| 123 | + private function getInputValue(TableFieldEntity $field, array | null $rowData): mixed |
|
| 124 | 124 | { |
| 125 | 125 | $update = $this->operation === 'update'; |
| 126 | 126 | // $default = $options["set"][$this->driver->bracketEscape($name)] ?? null; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return FieldEditEntity |
| 196 | 196 | */ |
| 197 | - public function getFieldInputValues(TableFieldEntity $field, array|null $rowData): FieldEditEntity |
|
| 197 | + public function getFieldInputValues(TableFieldEntity $field, array | null $rowData): FieldEditEntity |
|
| 198 | 198 | { |
| 199 | 199 | $editField = new FieldEditEntity($field); |
| 200 | 200 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return array |
| 45 | 45 | */ |
| 46 | - private function getCheckedAttr(FieldEditEntity $editField, string $fieldName, string|null $enumValue): array |
|
| 46 | + private function getCheckedAttr(FieldEditEntity $editField, string $fieldName, string | null $enumValue): array |
|
| 47 | 47 | { |
| 48 | 48 | $checked = is_array($editField->value) ? |
| 49 | 49 | in_array($fieldName, $editField->value) : $editField->value === $enumValue; |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @param FieldEditEntity $editField |
| 57 | 57 | */ |
| 58 | - private function itemList(FieldEditEntity $editField, array $attrs, string $default = ""): array|null |
|
| 58 | + private function itemList(FieldEditEntity $editField, array $attrs, string $default = ""): array | null |
|
| 59 | 59 | { |
| 60 | - if ($editField->type !== 'enum' && $editField->type !== 'set' ) { |
|
| 60 | + if ($editField->type !== 'enum' && $editField->type !== 'set') { |
|
| 61 | 61 | // Only for enums and sets |
| 62 | 62 | return null; |
| 63 | 63 | } |
@@ -264,8 +264,7 @@ discard block |
||
| 264 | 264 | preg_match('~^(\d+)(,(\d+))?$~', $length, $match) ? |
| 265 | 265 | ((preg_match("~binary~", $type) ? 2 : 1) * |
| 266 | 266 | ($match[1] ?? 0) + (($match[3] ?? false) ? 1 : 0) + |
| 267 | - (($match[2] ?? false) && !$unsigned ? 1 : 0)) : |
|
| 268 | - (isset($types[$type]) ? $types[$type] + ($unsigned ? 0 : 1) : 0) |
|
| 267 | + (($match[2] ?? false) && !$unsigned ? 1 : 0)) : (isset($types[$type]) ? $types[$type] + ($unsigned ? 0 : 1) : 0) |
|
| 269 | 268 | ); |
| 270 | 269 | |
| 271 | 270 | return $this->driver->jush() === 'sql' && |
@@ -312,7 +311,7 @@ discard block |
||
| 312 | 311 | * |
| 313 | 312 | * @return array |
| 314 | 313 | */ |
| 315 | - private function getFieldValueInput(FieldEditEntity $editField, bool|null $autofocus): array |
|
| 314 | + private function getFieldValueInput(FieldEditEntity $editField, bool | null $autofocus): array |
|
| 316 | 315 | { |
| 317 | 316 | // From input(array $field, $value, ?string $function, ?bool $autofocus = false) in html.inc.php |
| 318 | 317 | $attrs = [ |
@@ -349,7 +348,7 @@ discard block |
||
| 349 | 348 | * |
| 350 | 349 | * @return array|null |
| 351 | 350 | */ |
| 352 | - private function getFieldFunctionInput(FieldEditEntity $editField): array|null |
|
| 351 | + private function getFieldFunctionInput(FieldEditEntity $editField): array | null |
|
| 353 | 352 | { |
| 354 | 353 | // From html.inc.php: function input(array $field, $value, ?string $function, ?bool $autofocus = false) |
| 355 | 354 | if ($editField->type === 'enum' || $editField->function === null) { |
@@ -381,7 +380,7 @@ discard block |
||
| 381 | 380 | * |
| 382 | 381 | * @return void |
| 383 | 382 | */ |
| 384 | - public function setFieldInputValues(FieldEditEntity $editField, bool|null $autofocus): void |
|
| 383 | + public function setFieldInputValues(FieldEditEntity $editField, bool | null $autofocus): void |
|
| 385 | 384 | { |
| 386 | 385 | $editField->functionInput = $this->getFieldFunctionInput($editField); |
| 387 | 386 | $editField->valueInput = $this->getFieldValueInput($editField, $autofocus); |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | */ |
| 120 | 120 | public function isText(): bool |
| 121 | 121 | { |
| 122 | - return $this->isText ??= (bool)preg_match('~text|lob|memo~i', $this->type); |
|
| 122 | + return $this->isText ??= (bool) preg_match('~text|lob|memo~i', $this->type); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |