Skip to content

Commit 0ab92b4

Browse files
authored
Simplify the queryString methods
1 parent 6cebf9b commit 0ab92b4

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/Traits/Core/QueryStrings/HasQueryStringForFilter.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ trait HasQueryStringForFilter
1313

1414
protected function queryStringHasQueryStringForFilter(): array
1515
{
16-
if ($this->queryStringForFilterIsEnabled()) {
17-
return [
16+
return ($this->queryStringForFilterIsEnabled()) ?
17+
[
1818
'appliedFilters' => ['except' => null, 'history' => false, 'keep' => false, 'as' => $this->getQueryStringAliasForFilter()],
1919
'filterComponents' => ['except' => null, 'history' => false, 'keep' => false, 'as' => $this->getQueryStringAliasForFilter()],
20-
];
21-
}
22-
23-
return [];
20+
] : [];
2421
}
2522

2623
public function setupQueryStringStatusForFilter(): void

src/Traits/Core/QueryStrings/HasQueryStringForSearch.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@ trait HasQueryStringForSearch
1313

1414
protected function queryStringHasQueryStringForSearch(): array
1515
{
16-
if ($this->queryStringForSearchEnabled() && $this->searchIsEnabled()) {
17-
return [
18-
'search' => ['except' => null, 'history' => false, 'keep' => false, 'as' => $this->getQueryStringAliasForSearch()],
19-
];
20-
}
16+
return ($this->queryStringForSearchEnabled() && $this->searchIsEnabled()) ? [ 'search' => ['except' => null, 'history' => false, 'keep' => false, 'as' => $this->getQueryStringAliasForSearch()]] : [];
2117

22-
return [];
2318
}
2419

2520
public function setupQueryStringStatusForSearch(): void

0 commit comments

Comments
 (0)