Skip to content

Commit

Permalink
Dev: PHP CS Fixer code style
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanJard committed Nov 12, 2024
1 parent 0f81161 commit 1d7edef
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
42 changes: 25 additions & 17 deletions Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -900,6 +900,7 @@ public function validator($afterFields, $_ = null)

// Argument shift
$_ = $afterFields;

return $this->_getSet($this->_validator, $_, true);
}

Expand Down Expand Up @@ -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],
Expand All @@ -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],
'='
);
}
}
});
}
Expand Down Expand Up @@ -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)
{
Expand Down
26 changes: 13 additions & 13 deletions Editor/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 = [];

Check failure on line 101 in Editor/Options.php

View workflow job for this annotation

GitHub Actions / Unit (latest, StaticAnalysis)

Property DataTables\Editor\Options::$_manualAdd is never read, only written.
Expand Down Expand Up @@ -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)
*/
Expand All @@ -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.
Expand Down Expand Up @@ -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)
*/
Expand All @@ -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)
*/
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 1d7edef

Please sign in to comment.