Skip to content

Commit

Permalink
Refactor AbstractQueryParamManipulator
Browse files Browse the repository at this point in the history
  • Loading branch information
otsch committed Jan 14, 2024
1 parent df7f4da commit 42eba9f
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
}
}

0 comments on commit 42eba9f

Please sign in to comment.