abstract_validator implements validator_interface
AbstractYes
Base validator implementation using Respect\Validation.
Table of Contents
Interfaces
- validator_interface
- Contract for request validation rules.
Properties
- $errors : array<string, string>
Methods
- get_errors() : array<string, string>
- Get the validation errors.
- validate() : bool
- Validate the given data.
- get_custom_message() : null|string
- Override to provide custom error messages.
- rules() : array<string, AbstractRule|Validator>
- Define the validation rules.
Properties
$errors
protected
array<string, string>
$errors
= []
Methods
get_errors()
Get the validation errors.
public
get_errors() : array<string, string>
Return values
array<string, string> —field => error message
validate()
Validate the given data.
public
validate(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
-
Input data (usually from $_POST or $_GET)
Return values
bool —True if valid
get_custom_message()
Override to provide custom error messages.
protected
get_custom_message(string $field) : null|string
Parameters
- $field : string
Return values
null|stringrules()
Define the validation rules.
protected
abstract rules() : array<string, AbstractRule|Validator>