Skip to content

Commit

Permalink
update empty logic
Browse files Browse the repository at this point in the history
  • Loading branch information
oooiik committed Nov 9, 2022
1 parent 014b75e commit 2d02c91
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Services/FilterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FilterService
*/
public function __construct($client, Builder $builder)
{
if(is_string($client)){
if (is_string($client)) {
$client = new $client();
}
$this->client = $client;
Expand Down Expand Up @@ -50,18 +50,18 @@ protected function getClientMethods()
protected function getClientDefault(string $key = null)
{
if (empty($key)) {
return $this->getClient()->default ?? [];
return empty($this->getClient()->default) ? [] : $this->getClient()->default;
} else {
return $this->getClientDefault()[$key] ?? null;
return empty($this->getClientDefault()[$key]) ? null : $this->getClientDefault()[$key];
}
}

protected function getClientFallback(string $key = null)
{
if ($key === null) {
return $this->getClient()->fallback ?? [];
return empty($this->getClient()->fallback) ? [] : $this->getClient()->fallback;
} else {
return $this->getClientFallback()[$key] ?? null;
return empty($this->getClientFallback()[$key]) ? null : $this->getClientFallback()[$key];
}
}

Expand All @@ -80,7 +80,7 @@ protected function getParam($key = null)
if ($key === null) {
return $this->params;
} else {
return $this->params[$key] ?? null;
return empty($this->params[$key]) ? null : $this->params[$key];
}
}

Expand Down

0 comments on commit 2d02c91

Please sign in to comment.