From 42eba9f669e32b7276fca83ffb560217f8eb9667 Mon Sep 17 00:00:00 2001 From: otsch Date: Sun, 14 Jan 2024 14:22:48 +0100 Subject: [PATCH] Refactor AbstractQueryParamManipulator --- .../QueryParams/AbstractQueryParamManipulator.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Steps/Loading/Http/Paginators/QueryParams/AbstractQueryParamManipulator.php b/src/Steps/Loading/Http/Paginators/QueryParams/AbstractQueryParamManipulator.php index 8795cd7..0dc4123 100644 --- a/src/Steps/Loading/Http/Paginators/QueryParams/AbstractQueryParamManipulator.php +++ b/src/Steps/Loading/Http/Paginators/QueryParams/AbstractQueryParamManipulator.php @@ -22,6 +22,9 @@ protected function getCurrentValue(Query $query, mixed $fallbackValue = null): m return $fallbackValue; } + /** + * @throws Exception + */ protected function getCurrentValueUsingDotNotation(Query $query, mixed $fallbackValue = null): mixed { $dot = new Dot($query->toArray()); @@ -34,15 +37,14 @@ protected function getCurrentValueUsingDotNotation(Query $query, mixed $fallback */ protected function getCurrentValueAsInt(Query $query): int { - $currentValue = $this->getCurrentValue($query); - - return $currentValue === null ? 0 : (int) $currentValue; + return (int) $this->getCurrentValue($query); } + /** + * @throws Exception + */ protected function getCurrentValueAsIntUsingDotNotation(Query $query): int { - $currentValue = $this->getCurrentValueUsingDotNotation($query); - - return $currentValue === null ? 0 : (int) $currentValue; + return (int) $this->getCurrentValueUsingDotNotation($query); } }