Jinya CMS

CheckRequiredFieldsMiddleware
in package
implements MiddlewareInterface

Middleware to check for required fields in the parsed body

Tags

Interfaces, Classes, Traits and Enums

MiddlewareInterface

Table of Contents

$fields  : array<string|int, mixed>
__construct()  : mixed
CheckFieldsMiddleware constructor.
process()  : ResponseInterface
Processes the middleware, during the processing the request will be checked for all required fields
checkRequiredFields()  : void
Checks the required fields in the given request body. If the fields don't match, a MissingFieldsException is thrown

Properties

Methods

__construct()

CheckFieldsMiddleware constructor.

public __construct(array<string|int, string> $fields) : mixed
Parameters
$fields : array<string|int, string>

The required fields

Tags
Return values
mixed

process()

Processes the middleware, during the processing the request will be checked for all required fields

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Tags
throws
JsonException
Return values
ResponseInterface

checkRequiredFields()

Checks the required fields in the given request body. If the fields don't match, a MissingFieldsException is thrown

private checkRequiredFields(array<string, mixed> $body, array<string|int, string> $requiredFields, ServerRequestInterface $request) : void
Parameters
$body : array<string, mixed>
$requiredFields : array<string|int, string>
$request : ServerRequestInterface
Tags
throws
MissingFieldsException
Return values
void

Search results