Skip to content

Commit

Permalink
refactor: add array_key_exists() check
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jan 16, 2023
1 parent ffce097 commit 945342c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1161,15 +1161,15 @@ public function getFiltersForRoute(string $search, ?string $verb = null): array
{
$options = $this->loadRoutesOptions($verb);

if (! array_key_exists($search, $options)) {
if (! array_key_exists($search, $options) || ! array_key_exists('filter', $options[$search])) {
return [];
}

if (is_string($options[$search]['filter'])) {
return [$options[$search]['filter']];
}

return $options[$search]['filter'] ?? [];
return $options[$search]['filter'];
}

/**
Expand Down

0 comments on commit 945342c

Please sign in to comment.