From a48d0d1e906ee01d8589cc489b5d46403c1a027f Mon Sep 17 00:00:00 2001 From: oooiik Date: Wed, 9 Nov 2022 16:59:09 +0500 Subject: [PATCH] update empty logic --- src/Services/FilterService.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Services/FilterService.php b/src/Services/FilterService.php index c75d01f..57cec5b 100644 --- a/src/Services/FilterService.php +++ b/src/Services/FilterService.php @@ -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; } } @@ -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; } } @@ -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; } }