Skip to content

Commit

Permalink
refactor: rename variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Oct 18, 2023
1 parent bdb003b commit 8003927
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions system/Filters/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,17 @@ public function runRequired(string $position = 'before')
$this->config->required['after'][] = 'toolbar';
}

$filtersClass = [];
$filterClasses = [];

foreach ($this->config->required[$position] as $alias) {
if (! array_key_exists($alias, $this->config->aliases)) {
throw FilterException::forNoAlias($alias);
}

if (is_array($this->config->aliases[$alias])) {
$filtersClass[$position] = array_merge($filtersClass[$position], $this->config->aliases[$alias]);
$filterClasses[$position] = array_merge($filterClasses[$position], $this->config->aliases[$alias]);
} else {
$filtersClass[$position][] = $this->config->aliases[$alias];
$filterClasses[$position][] = $this->config->aliases[$alias];
}
}

Expand Down Expand Up @@ -702,7 +702,7 @@ private function registerArguments(string $name, array $arguments, bool $check =
*/
protected function processAliasesToClass(string $position)
{
$filtersClass = [];
$filterClasses = [];

foreach ($this->filters[$position] as $alias => $rules) {
if (is_numeric($alias) && is_string($rules)) {
Expand All @@ -714,18 +714,18 @@ protected function processAliasesToClass(string $position)
}

if (is_array($this->config->aliases[$alias])) {
$filtersClass = array_merge($filtersClass, $this->config->aliases[$alias]);
$filterClasses = array_merge($filterClasses, $this->config->aliases[$alias]);
} else {
$filtersClass[] = $this->config->aliases[$alias];
$filterClasses[] = $this->config->aliases[$alias];
}
}

// when using enableFilter() we already write the class name in $filtersClass as well as the
// when using enableFilter() we already write the class name in $filterClasses as well as the
// alias in $filters. This leads to duplicates when using route filters.
if ($position === 'before') {
$this->filtersClass[$position] = array_merge($filtersClass, $this->filtersClass[$position]);
$this->filtersClass[$position] = array_merge($filterClasses, $this->filtersClass[$position]);
} else {
$this->filtersClass[$position] = array_merge($this->filtersClass[$position], $filtersClass);
$this->filtersClass[$position] = array_merge($this->filtersClass[$position], $filterClasses);
}

// Since some filters like rate limiters rely on being executed once a request we filter em here.
Expand Down

0 comments on commit 8003927

Please sign in to comment.