abstract class abstract_validator implements validator_interface

Base validator implementation using Respect\Validation.

Properties

protected array<string,string> $errors

Methods

bool
validate(array $data)

Validate the given data.

array
get_errors()

Get the validation errors.

array
rules()

Define the validation rules.

string|null
get_custom_message(string $field)

Override to provide custom error messages.

Details

at line 36
bool validate(array $data)

Validate the given data.

Parameters

array $data

Input data (usually from $_POST or $_GET)

Return Value

bool

True if valid

Exceptions

RuntimeException

at line 59
array get_errors()

Get the validation errors.

Return Value

array

field => error message

at line 69
abstract protected array rules()

Define the validation rules.

Return Value

array

at line 78
protected string|null get_custom_message(string $field)

Override to provide custom error messages.

Parameters

string $field

Return Value

string|null