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 28
protected bool
expectsType(array $mimeTypes, string|null $suffix = null)
Does the client expect the provided mime type?
in ContentNegotiationTrait at line 45
protected bool
expectsJson()
Does the client expect JSON?
in ContentNegotiationTrait at line 55
protected bool
expectsXml()
Does the client expect XML?
in ContentNegotiationTrait at line 67
protected bool
respondWithType(array $mimeTypes, string|null $suffix = null)
Should we respond with the provided mime type?
in ContentNegotiationTrait at line 84
protected bool
respondWithJson()
Should we respond with JSON?
in ContentNegotiationTrait at line 94
protected bool
respondWithXml()
Should we respond with XML?
at line 135
__construct(URLBuilder $urlBuilder, Session|null $session = null, ViewFactory|null $viewFactory = null)
Constructor.
at line 149
protected
setInput(HttpInputInterface|null $input)
Set the input.
at line 159
protected bool
shouldRedirect()
Should we redirect the client if possible?
at line 174
protected bool
shouldIncludeOldInput()
Should the old input be included?
at line 189
protected array
getOldInput()
Returns the old input.
at line 208
protected string
getRedirectUrl()
Returns the redirect URL.
at line 224
protected Response
handleRedirect(ValidationException $exception)
Add errors to flash data and redirect.
at line 243
protected string
getErrorMessage()
Returns the error message.
at line 260
protected string
buildXmlFromException(ValidationException $exception, string $charset)
Builds XML based on the exception.
at line 282
protected Response
handleOutput(ValidationException $exception)
Output errors.