ServerSideValidatorInterface
ServerSideValidator Interface.
Loads validation rules from a schema and validates a target array of data.
Tags
Table of Contents
setSchema() | Set the schema for this validator, as a valid RequestSchemaInterface object. | mixed |
---|---|---|
setTranslator() | Set the translator for this validator, as a valid Translator object. | mixed |
validate() | Validate the specified data against the schema rules. | bool |
data() | Get array of fields and data. | array |
errors() | Get array of error messages. | array|bool |
Methods
setSchema()
Set the schema for this validator, as a valid RequestSchemaInterface object.
public
setSchema(
$schema :
RequestSchemaInterface
)
: mixed
Parameters
- $schema : RequestSchemaInterface
A RequestSchemaInterface object, containing the validation rules.
Return values
mixedsetTranslator()
Set the translator for this validator, as a valid Translator object.
public
setTranslator(
$translator :
Translator
)
: mixed
Parameters
- $translator : Translator
A Translator to be used to translate message ids found in the schema.
Return values
mixedvalidate()
Validate the specified data against the schema rules.
public
validate(
$data :
array
)
: bool
Parameters
- $data : array
An array of data, mapping field names to field values.
Return values
bool —True if the data was successfully validated, false otherwise.
data()
Get array of fields and data.
public
data(
)
: array
Return values
arrayerrors()
Get array of error messages.
public
errors(
)
: array|bool