getParamFloatRange.php
Table of Contents
Functions
- getParamFloatRange() : float|null
- Retrieves a float parameter from the request and clamps it within a given range.
Functions
getParamFloatRange()
Retrieves a float parameter from the request and clamps it within a given range.
getParamFloatRange(ServerRequestInterface|null $request, string $name, float $min, float $max[, float|null $defaultValue = null ][, array<string|int, mixed> $args = [] ][, string $strategy = HttpParamStrategy::BOTH ][, bool $throwable = false ]) : float|null
Wrapper around getParamNumberRange() that ensures float return type.
Parameters
- $request : ServerRequestInterface|null
-
The PSR-7 server request instance. Can be null.
- $name : string
-
The parameter name or dot-notated path.
- $min : float
-
Minimum allowed float value.
- $max : float
-
Maximum allowed float value.
- $defaultValue : float|null = null
-
Value returned if the parameter is missing or not numeric. Default null.
- $args : array<string|int, mixed> = []
-
Optional defaults passed to getParam().
- $strategy : string = HttpParamStrategy::BOTH
-
Which source to search:
HttpParamStrategy::BOTH|QUERY|BODY. Default BOTH. - $throwable : bool = false
-
Whether to throw NotFoundException if the parameter is missing. Default false.
Tags
Return values
float|null —The float value clamped to [$min, $max], or $defaultValue/null if missing or invalid.