From 1d7edefa1099f5dfce10ce28e30f38cdbe719c11 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 12 Nov 2024 12:47:08 +0000 Subject: [PATCH] Dev: PHP CS Fixer code style --- Editor.php | 42 +++++++++++++++++++++++++----------------- Editor/Options.php | 26 +++++++++++++------------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/Editor.php b/Editor.php index f3169f2..862e403 100644 --- a/Editor.php +++ b/Editor.php @@ -884,11 +884,11 @@ public function validate(&$errors, $data) * and remove actions performed from the client-side. Multiple validators * can be added. * - * @param bool|callable $afterFields `true` to run the validator after field validation, - * `false` to run before. Can be omitted (which is the equivalent of `false`). - * @param callable($this, self::ACTION_*, array): ?string $_ Function to execute when validating the input data. - * It is passed three parameters: 1. The editor instance, 2. The action - * and 3. The values. + * @param bool|callable $afterFields `true` to run the validator after field validation, + * `false` to run before. Can be omitted (which is the equivalent of `false`). + * @param callable($this, self::ACTION_*, array): ?string $_ Function to execute when validating the input data. + * It is passed three parameters: 1. The editor instance, 2. The action + * and 3. The values. * * @return ($_ is null ? callable : $this) The validator function. */ @@ -900,6 +900,7 @@ public function validator($afterFields, $_ = null) // Argument shift $_ = $afterFields; + return $this->_getSet($this->_validator, $_, true); } @@ -1917,10 +1918,12 @@ private function _ssp_filter($query, $http) $q->left_join($this->_leftJoin); // ... where the selected option is present... - if (isset($http['searchPanes_null'][$field->name()][$i]) && $http['searchPanes_null'][$field->name()][$i] === 'true') { + if ( + isset($http['searchPanes_null'][$field->name()][$i]) + && $http['searchPanes_null'][$field->name()][$i] === 'true' + ) { $q->where($field->dbField(), null, '='); - } - else { + } else { $q->where( $field->dbField(), $http['searchPanes'][$field->name()][$i], @@ -1941,13 +1944,18 @@ private function _ssp_filter($query, $http) $query->where(static function ($q) use ($field, $http) { for ($j = 0; $j < count($http['searchPanes'][$field->name()]); ++$j) { - $q->or_where( - $field->dbField(), - isset($http['searchPanes_null'][$field->name()][$j]) && $http['searchPanes_null'][$field->name()][$j] === 'true' - ? null - : $http['searchPanes'][$field->name()][$j], - '=' - ); + if ( + isset($http['searchPanes_null'][$field->name()][$j]) + && $http['searchPanes_null'][$field->name()][$j] === 'true' + ) { + $q->or_where($field->dbField(), null, '='); + } else { + $q->or_where( + $field->dbField(), + $http['searchPanes'][$field->name()][$j], + '=' + ); + } } }); } @@ -2232,9 +2240,9 @@ private function _insert_or_update_table($table, $values, $where = null) } /** - * Get option lists for select, radio, autocomplete, etc + * Get option lists for select, radio, autocomplete, etc. * - * @param boolean $refresh false for initial load, true if after insert, update + * @param bool $refresh false for initial load, true if after insert, update */ private function _options($refresh) { diff --git a/Editor/Options.php b/Editor/Options.php index c638970..a189800 100644 --- a/Editor/Options.php +++ b/Editor/Options.php @@ -68,7 +68,7 @@ class Options extends Ext * Private parameters */ - /** @var boolean Indicate if options should always be refreshed */ + /** @var bool Indicate if options should always be refreshed */ private $_alwaysRefresh = true; /** @var string Table to get the information from */ @@ -89,13 +89,13 @@ class Options extends Ext /** @var callable Callback function to do rendering of labels */ private $_renderer; - /** @var boolean Indicate if options should get got for create/edit or on search only */ + /** @var bool Indicate if options should get got for create/edit or on search only */ private $_searchOnly = false; /** @var callable Callback function to add where conditions */ private $_where; - /** @var string|boolean ORDER BY clause */ + /** @var string|bool ORDER BY clause */ private $_order = true; private $_manualAdd = []; @@ -131,10 +131,10 @@ public function add($label, $value = null) /** * Get / set the flag to indicate if the options should always be refreshed - * (i.e. on get, create and edit) or only on the initial data load (false) + * (i.e. on get, create and edit) or only on the initial data load (false). * - * @param boolean|null $_ Flag to set the always refresh set to, or null to - * get the current state. + * @param bool|null $_ Flag to set the always refresh set to, or null to + * get the current state. * * @return ($_ is null ? boolean : $this) */ @@ -144,7 +144,7 @@ public function alwaysRefresh($_ = null) } /** - * Custom function to get the options, rather than using the built in DB + * Custom function to get the options, rather than using the built in DB. * * @param callable|null $_ Function that will be run to get the list of * options. @@ -218,7 +218,7 @@ public function limit($_ = null) * renderer. If `false` no ordering will be performed and whatever is returned * from the database will be used. * - * @param string|boolean|null $_ String to set, null to get current value + * @param string|bool|null $_ String to set, null to get current value * * @return ($_ is null ? string : $this) */ @@ -243,10 +243,10 @@ public function render($_ = null) /** * Get / set the flag to indicate if the options should always be refreshed - * (i.e. on get, create and edit) or only on the initial data load (false) + * (i.e. on get, create and edit) or only on the initial data load (false). * - * @param boolean|null $_ Flag to set the always refresh set to, or null to - * get the current state. + * @param bool|null $_ Flag to set the always refresh set to, or null to + * get the current state. * * @return ($_ is null ? boolean : $this) */ @@ -301,8 +301,8 @@ public function where($_ = null) /** * Execute the options (i.e. get them). * - * @param Database $db Database connection - * @param boolean $refresh Indicate if this is a refresh or a full load + * @param Database $db Database connection + * @param bool $refresh Indicate if this is a refresh or a full load * * @return array List of options *