Oihana PHP

PrepareSearch

Prepares the `search` parameter of a controller request.

This trait reads the ControllerParam::SEARCH value from the route arguments and lets the request query string override it. When the request supplies a value it is recorded in the parameter bag (when one is provided).

Only the query string is inspected (the request body is ignored).

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Methods

prepareSearch()  : string|null
Prepares and returns the `search` value.

Methods

prepareSearch()

Prepares and returns the `search` value.

protected prepareSearch(ServerRequestInterface|null $request[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null &$params = null ]) : string|null
Parameters
$request : ServerRequestInterface|null

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

$args : array<string|int, mixed> = []

The route/controller arguments that may carry an initial search value.

$params : array<string|int, mixed>|null = null

A reference to the parameter bag updated in place with the prepared search term.

Return values
string|null

The resolved search term, or null when none is provided.

On this page

Search results