Oihana PHP

PrepareInterval

Prepares the `interval` parameter of a time-based controller request.

This trait reads the ControllerParam::INTERVAL query parameter and validates it as an integer constrained between 1 and the maxRange supplied by $timeOptions. When no valid value is provided it falls back to the ControllerParam::INTERVAL_DEFAULT entry of $timeOptions, and a request-provided value is mirrored into the parameter bag.

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Methods

prepareInterval()  : void
Prepares the `interval` parameter from the request.

Methods

prepareInterval()

Prepares the `interval` parameter from the request.

protected prepareInterval(ServerRequestInterface|null $request, array<string|int, mixed> &$params, string|null &$interval, array<string|int, mixed>|null $timeOptions) : void
Parameters
$request : ServerRequestInterface|null

The incoming PSR-7 server request, or null when no request context is available.

$params : array<string|int, mixed>

A reference to the parameter bag updated in place with the resolved interval.

$interval : string|null

A reference to the interval holder assigned in place with the validated value.

$timeOptions : array<string|int, mixed>|null

The time configuration providing the FilterOption::MAX_RANGE bound and default interval.

On this page

Search results