PrepareLimit uses trait:short, trait:short, trait:short
Table of Contents
Properties
- $limit : int|null
- The default limit value.
- $maxLimit : int|null
- The maximum limit value.
- $minLimit : int|null
- The minimum limit value.
- $offset : int|null
- The default limit value.
- $pagination : Pagination|null
- The pagination definition.
- $paramsStrategy : string
- Strategy to fetch parameters: 'both' (default), 'body' only, or 'query' only.
Methods
- getBodyParam() : mixed|null
- Get a single parameter from the request body.
- getBodyParams() : array<string|int, mixed>|null
- Get multiple parameters from the request body.
- getParam() : mixed
- Get a single parameter from query or body according to the current strategy.
- getParams() : array<string|int, mixed>|null
- Get all query parameters or body parameters if query is empty.
- getQueryParam() : string|null
- Get a single parameter from query string.
- initializeLimit() : static
- Initialize the min/max limit range.
- initializePagination() : static
- Initializes the `pagination` property.
- initializeParamsStrategy() : static
- Initialize the params strategy : 'both' (default), 'body' (only), 'query' (only).
- getParamArray() : array<string|int, mixed>|null
- Get an array parameter from request.
- getParamBool() : bool|null
- Get a boolean parameter from request.
- getParamDefaultValueInModel() : mixed
- Generates the status property from the current Request or find it in the status model with the default label ('on' by default).
- getParamFloat() : float|null
- Get a float parameter.
- getParamFloatWithRange() : float|null
- getParamInt() : int|null
- Get an integer parameter.
- getParamIntWithRange() : int|null
- getParamNumberWithRange() : mixed
- Get a numeric parameter with a min/max range validation.
- getParamString() : string|null
- prepareLimit() : int
- Prepare and returns the 'limit' value.
- prepareOffset() : int
- Prepare and returns the 'offset' value.
Properties
$limit
The default limit value.
public
int|null
$limit
= null
$maxLimit
The maximum limit value.
public
int|null
$maxLimit
= null
$minLimit
The minimum limit value.
public
int|null
$minLimit
= null
$offset
The default limit value.
public
int|null
$offset
= null
$pagination
The pagination definition.
public
Pagination|null
$pagination
= null
$paramsStrategy
Strategy to fetch parameters: 'both' (default), 'body' only, or 'query' only.
public
string
$paramsStrategy
= \oihana\enums\http\HttpParamStrategy::BOTH
Methods
getBodyParam()
Get a single parameter from the request body.
public
getBodyParam(ServerRequestInterface|null $request, string $name) : mixed|null
Supports dot notation for nested values.
Parameters
- $request : ServerRequestInterface|null
- $name : string
-
Parameter key, can be nested ('geo.latitude').
Return values
mixed|nullgetBodyParams()
Get multiple parameters from the request body.
public
getBodyParams(ServerRequestInterface|null $request, array<string|int, string> $names) : array<string|int, mixed>|null
Only keys present in the body are returned, nested keys supported.
Parameters
- $request : ServerRequestInterface|null
- $names : array<string|int, string>
-
Array of keys to retrieve, can use dot notation.
Return values
array<string|int, mixed>|null —Associative array of key => value.
getParam()
Get a single parameter from query or body according to the current strategy.
public
getParam(ServerRequestInterface|null $request, string $name[, array<string|int, mixed> $default = [] ][, bool $throwable = false ]) : mixed
Supports dot notation for nested keys.
Parameters
- $request : ServerRequestInterface|null
- $name : string
-
Parameter key
- $default : array<string|int, mixed> = []
-
Default array to look up the value if not found
- $throwable : bool = false
-
If true, throws NotFoundException when parameter is not found
Tags
getParams()
Get all query parameters or body parameters if query is empty.
public
getParams(ServerRequestInterface|null $request) : array<string|int, mixed>|null
Parameters
- $request : ServerRequestInterface|null
Return values
array<string|int, mixed>|nullgetQueryParam()
Get a single parameter from query string.
public
getQueryParam(ServerRequestInterface|null $request, string $name) : string|null
Supports dot notation for nested keys.
Parameters
- $request : ServerRequestInterface|null
- $name : string
Return values
string|nullinitializeLimit()
Initialize the min/max limit range.
public
initializeLimit([array<string|int, mixed> $init = [] ]) : static
Parameters
- $init : array<string|int, mixed> = []
Return values
staticinitializePagination()
Initializes the `pagination` property.
public
initializePagination([array<string|int, mixed> $init = [] ][, ContainerInterface|null $container = null ]) : static
This method retrieves the default pagination settings for the application, either from the provided initialization array or from the dependency injection container.
Parameters
- $init : array<string|int, mixed> = []
-
Optional initialization array (e.g., ['pagination' => Pagination instance]).
- $container : ContainerInterface|null = null
-
Optional DI container for retrieving the App instance.
Tags
Return values
static —Returns the current controller instance for method chaining.
initializeParamsStrategy()
Initialize the params strategy : 'both' (default), 'body' (only), 'query' (only).
public
initializeParamsStrategy([string|array<string|int, mixed>|null $strategy = null ]) : static
Parameters
- $strategy : string|array<string|int, mixed>|null = null
-
$strategy Either a string strategy or an array with key ControllerParam::PARAMS_STRATEGY.
Tags
Return values
staticgetParamArray()
Get an array parameter from request.
protected
getParamArray(ServerRequestInterface|null $request, string $name[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null $defaultValue = null ][, bool $throwable = false ]) : array<string|int, mixed>|null
Returns null if not found and defaultValue is not set.
Parameters
- $request : ServerRequestInterface|null
- $name : string
- $args : array<string|int, mixed> = []
- $defaultValue : array<string|int, mixed>|null = null
- $throwable : bool = false
Tags
Return values
array<string|int, mixed>|nullgetParamBool()
Get a boolean parameter from request.
protected
getParamBool(ServerRequestInterface|null $request, string $name[, array<string|int, mixed> $args = [] ][, bool|null $defaultValue = null ][, bool $throwable = false ]) : bool|null
Returns null if not found and defaultValue is not set.
Parameters
- $request : ServerRequestInterface|null
- $name : string
- $args : array<string|int, mixed> = []
-
Additional arguments (ignored)
- $defaultValue : bool|null = null
- $throwable : bool = false
Tags
Return values
bool|nullgetParamDefaultValueInModel()
Generates the status property from the current Request or find it in the status model with the default label ('on' by default).
protected
getParamDefaultValueInModel(ServerRequestInterface|null $request, string $name, null|string|GetModel $model[, string|null $key = null ][, string|null $value = null ][, string $fields = Prop::_KEY ][, string $property = Prop::_KEY ][, bool $throwable = false ]) : mixed
Parameters
- $request : ServerRequestInterface|null
- $name : string
-
The name of the parameter.
- $model : null|string|GetModel
-
The identifier of the model.
- $key : string|null = null
-
The key in the collection to target to find the default value.
- $value : string|null = null
-
The value to search in the model to returns the good key.
- $fields : string = Prop::_KEY
- $property : string = Prop::_KEY
-
The name of the property to extract in the model result.
- $throwable : bool = false
Tags
getParamFloat()
Get a float parameter.
protected
getParamFloat(ServerRequestInterface|null $request, string $name[, array<string|int, mixed> $args = [] ][, float|null $defaultValue = null ][, bool $throwable = false ]) : float|null
Parameters
- $request : ServerRequestInterface|null
- $name : string
- $args : array<string|int, mixed> = []
- $defaultValue : float|null = null
- $throwable : bool = false
Tags
Return values
float|nullgetParamFloatWithRange()
protected
getParamFloatWithRange(ServerRequestInterface|null $request, string $name, float $min, float $max[, mixed $defaultValue = null ][, array<string|int, mixed> $args = [] ][, bool $throwable = false ]) : float|null
Parameters
- $request : ServerRequestInterface|null
- $name : string
- $min : float
- $max : float
- $defaultValue : mixed = null
- $args : array<string|int, mixed> = []
- $throwable : bool = false
Tags
Return values
float|nullgetParamInt()
Get an integer parameter.
protected
getParamInt(ServerRequestInterface|null $request, string $name[, array<string|int, mixed> $args = [] ][, int|null $defaultValue = null ][, bool $throwable = false ]) : int|null
Parameters
- $request : ServerRequestInterface|null
- $name : string
- $args : array<string|int, mixed> = []
- $defaultValue : int|null = null
- $throwable : bool = false
Tags
Return values
int|nullgetParamIntWithRange()
protected
getParamIntWithRange(ServerRequestInterface|null $request, string $name, int $min, int $max[, mixed $defaultValue = null ][, array<string|int, mixed> $args = [] ][, bool $throwable = false ]) : int|null
Parameters
- $request : ServerRequestInterface|null
- $name : string
- $min : int
- $max : int
- $defaultValue : mixed = null
- $args : array<string|int, mixed> = []
- $throwable : bool = false
Tags
Return values
int|nullgetParamNumberWithRange()
Get a numeric parameter with a min/max range validation.
protected
getParamNumberWithRange(ServerRequestInterface|null $request, string $name, int $filter, int $min, int $max[, int|float|null $defaultValue = null ][, array<string|int, mixed> $args = [] ][, string $strategy = HttpParamStrategy::BOTH ][, bool $throwable = false ]) : mixed
Parameters
- $request : ServerRequestInterface|null
- $name : string
- $filter : int
-
FILTER_VALIDATE_INT or FILTER_VALIDATE_FLOAT
- $min : int
- $max : int
- $defaultValue : int|float|null = null
- $args : array<string|int, mixed> = []
- $strategy : string = HttpParamStrategy::BOTH
- $throwable : bool = false
Tags
getParamString()
protected
getParamString(ServerRequestInterface|null $request, string $name[, array<string|int, mixed> $args = [] ][, string|null $defaultValue = null ][, bool $throwable = false ]) : string|null
Parameters
- $request : ServerRequestInterface|null
- $name : string
- $args : array<string|int, mixed> = []
- $defaultValue : string|null = null
- $throwable : bool = false
Tags
Return values
string|nullprepareLimit()
Prepare and returns the 'limit' value.
protected
prepareLimit(ServerRequestInterface|null $request[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null &$params = null ][, int $defaultValue = 0 ][, string $property = Pagination::LIMIT ]) : int
Parameters
- $request : ServerRequestInterface|null
- $args : array<string|int, mixed> = []
- $params : array<string|int, mixed>|null = null
- $defaultValue : int = 0
- $property : string = Pagination::LIMIT
Return values
intprepareOffset()
Prepare and returns the 'offset' value.
protected
prepareOffset(ServerRequestInterface|null $request[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null &$params = null ][, int $defaultValue = 0 ]) : int
Parameters
- $request : ServerRequestInterface|null
- $args : array<string|int, mixed> = []
- $params : array<string|int, mixed>|null = null
- $defaultValue : int = 0