InputValidation
class InputValidation implements MiddlewareInterface
Input validation middleware.
Traits
Properties
protected Request | $request | Request. | |
protected Response | $response | Response. | |
protected int | $httpStatusCode | Default HTTP status code for invalid requests. | |
protected string | $errorsFlashKey | Session flash key for errors. | |
protected string | $oldInputFlashKey | Session flash key for old input. | |
protected string | $errorsVariableName | Errors view variable name. | |
protected string | $oldInputVariableName | Old input view variable name. | |
protected string | $defaultErrorMessage | Default error message. | |
protected array | $dontInclude | Keys that will be removed from the old input. | |
protected URLBuilder | $urlBuilder | URL builder. | |
protected Session|null | $session | Session. | |
protected ViewFactory|null | $viewFactory | View factory. | |
protected HttpInputInterface|null | $input | Input. |
Methods
Does the client expect the provided mime type?
Should we respond with the provided mime type?
Constructor.
Should we redirect the client if possible?
Should the old input be included?
Returns the old input.
Returns the redirect URL.
Returns the error message.
Builds XML based on the exception.
Details
in ContentNegotiationTrait at line 30
protected bool
expectsType(array $mimeTypes, string|null $suffix = null)
Does the client expect the provided mime type?
in ContentNegotiationTrait at line 47
protected bool
expectsJson()
Does the client expect JSON?
in ContentNegotiationTrait at line 57
protected bool
expectsXml()
Does the client expect XML?
in ContentNegotiationTrait at line 69
protected bool
respondWithType(array $mimeTypes, string|null $suffix = null)
Should we respond with the provided mime type?
in ContentNegotiationTrait at line 86
protected bool
respondWithJson()
Should we respond with JSON?
in ContentNegotiationTrait at line 96
protected bool
respondWithXml()
Should we respond with XML?
at line 137
__construct(URLBuilder $urlBuilder, Session|null $session = null, ViewFactory|null $viewFactory = null)
Constructor.
at line 151
protected
setInput(HttpInputInterface|null $input)
Set the input.
at line 161
protected bool
shouldRedirect()
Should we redirect the client if possible?
at line 176
protected bool
shouldIncludeOldInput()
Should the old input be included?
at line 191
protected array
getOldInput()
Returns the old input.
at line 210
protected string
getRedirectUrl()
Returns the redirect URL.
at line 226
protected Response
handleRedirect(ValidationException $exception)
Add errors to flash data and redirect.
at line 245
protected string
getErrorMessage()
Returns the error message.
at line 262
protected string
buildXmlFromException(ValidationException $exception, string $charset)
Builds XML based on the exception.
at line 284
protected Response
handleOutput(ValidationException $exception)
Output errors.