File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1313 */
1414class BaseConfig implements ConfigInterface
1515{
16+ private const DEFAULT_LIMIT = 10 ;
17+
1618 /**
1719 * @var Request
1820 */
@@ -106,7 +108,7 @@ public function addSearchByAliases(Alias $alias): ConfigInterface
106108 */
107109 public function getSearchByAliases (): array
108110 {
109- return $ this ->searchBy ['aliases ' ];
111+ return $ this ->searchBy ['aliases ' ] ?? [] ;
110112 }
111113
112114 /**
@@ -177,7 +179,7 @@ public function getRepositoryCallback(): callable
177179 */
178180 public function getAllowedLimits (): array
179181 {
180- return $ this ->allowedLimits ;
182+ return $ this ->allowedLimits ?? [] ;
181183 }
182184
183185 /**
@@ -205,7 +207,7 @@ public function setDefaultLimit(int $limit): ConfigInterface
205207 */
206208 public function getDefaultLimit (): int
207209 {
208- return $ this ->defaultLimit ;
210+ return $ this ->defaultLimit ?? self :: DEFAULT_LIMIT ;
209211 }
210212
211213 /**
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ public function setAllowedLimits(array $allowedLimits): ConfigInterface;
109109 *
110110 * @return array
111111 */
112- public function getAllowedLimits (): array ;
112+ public function getAllowedLimits (): ? array ;
113113
114114 /**
115115 * @var int $limit default limit in case of limit not specified or limit is not within the allowed limits
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ private function getQueryFilterArgs(ConfigInterface $config): QueryFilterArgs
226226
227227 $ limit = $ config ->getRequest ()->getLimit ();
228228 $ allowedLimits = $ config ->getAllowedLimits ();
229- if ($ limit === -1 || (! empty ( $ allowedLimits ) && ! in_array ($ limit , $ config -> getAllowedLimits () , true ) )) {
229+ if ($ limit === -1 || ! in_array ($ limit , $ allowedLimits , true )) {
230230 $ limit = $ config ->getDefaultLimit ();
231231 }
232232
You can’t perform that action at this time.
0 commit comments