API / Minn\Rest / ArgCheck

ArgCheck final readonly class

Minn\Rest\ArgCheck · public/minn/src/Minn/Rest/ArgCheck.php · 85 lines

Judges a route's declared arguments against the request before the policy is judged, the way the reference does: a required parameter that did not arrive is rest_missing_callback_param; the shared collection parameters (context, page, per_page, search) are judged first and a refusal among them is answered alone; then every other invalid one is listed in rest_invalid_param, in the order the route declares them, with the schema's own refusal under details. The query is read against the route's args, the JSON body against its body set, and a JSON body that does not parse is refused on every route first. An argument its handler judges (Args::HANDLER_VALIDATES) is left to the handler.

Constants and properties

privatereadonly Minn\Rest\Schema $schema

Promoted from the constructor.

Public

new__construct(Minn\Rest\Schema $schema)#
methodclosure(): Closure#

The check as the router takes it.

methodcheck(Minn\Http\Route $route, Minn\Http\Request $request, array $captures = array ( )): void#

Throws the refusal the declared arguments earn, or returns. @param array<string, string> $captures what the path named, for a route whose parameters depend on it

$capturesarray<string, string>what the path named, for a route whose parameters depend on it

Internals 3

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatejson(Minn\Http\Request $request): void#

A JSON body that does not parse is refused on every route, before its arguments are read; an empty one is not a body.

privatemissing(array $args, array $values): void#
$argsarray<string, array<string, mixed>>
$valuesarray<string, mixed>
privateround(array $sources): void#
$sourceslist<array{0: array<string, array<string, mixed>>, 1: array<string, mixed>}>