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 2d02c91 commit a48d0d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Services/FilterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ protected function getClientMethods()

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

Expand All @@ -61,7 +61,7 @@ protected function getClientFallback(string $key = null)
if ($key === null) {
return empty($this->getClient()->fallback) ? [] : $this->getClient()->fallback;
} else {
return empty($this->getClientFallback()[$key]) ? null : $this->getClientFallback()[$key];
return array_key_exists($key, $this->getClientFallback()) ? $this->getClientFallback()[$key] : null;
}
}

Expand All @@ -75,12 +75,12 @@ protected function setParams($params)
$this->params = array_merge($this->getClientDefault(), $params);
}

protected function getParam($key = null)
protected function getParam(string $key = null)
{
if ($key === null) {
return $this->params;
} else {
return empty($this->params[$key]) ? null : $this->params[$key];
return array_key_exists($key, $this->params) ? $this->params[$key] : null;
}
}

Expand Down

0 comments on commit a48d0d1

Please sign in to comment.