Documentation

Validator
in package

This is the validator class.

It's responsible for applying validations against a number of variables.

Table of Contents

$loader  : Loader
The loader instance.
$variables  : array<string|int, mixed>
The variables to validate.
__construct()  : void
Create a new validator instance.
allowedValues()  : Validator
Assert that each variable is amongst the given choices.
isBoolean()  : Validator
Assert that each specified variable is a boolean.
isInteger()  : Validator
Assert that each specified variable is an integer.
notEmpty()  : Validator
Assert that each variable is not empty.
assertCallback()  : Validator
Assert that the callback returns true for each variable.

Properties

$variables

The variables to validate.

protected array<string|int, mixed> $variables

Methods

__construct()

Create a new validator instance.

public __construct(array<string|int, mixed> $variables, Loader $loader) : void
Parameters
$variables : array<string|int, mixed>
$loader : Loader
Return values
void

allowedValues()

Assert that each variable is amongst the given choices.

public allowedValues(array<string|int, string> $choices) : Validator
Parameters
$choices : array<string|int, string>
Return values
Validator

Search results