Documentation

Validator
in package

Table of Contents

Properties

$repository  : RepositoryInterface
The environment repository instance.
$variables  : array<string|int, string>
The variables to validate.

Methods

__construct()  : void
Create a new validator instance.
allowedRegexValues()  : Validator
Assert that each variable matches the given regular expression.
allowedValues()  : Validator
Assert that each variable is amongst the given choices.
assert()  : Validator
Assert that the callback returns true for each variable.
assertNullable()  : Validator
Assert that the callback returns true for each variable.
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.
required()  : Validator
Assert that each variable is present.

Properties

$variables

The variables to validate.

private array<string|int, string> $variables

Methods

allowedValues()

Assert that each variable is amongst the given choices.

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

assert()

Assert that the callback returns true for each variable.

public assert( Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 callable(Array): bool $callback, string $message) : Validator
Parameters
$callback : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 callable(Array): bool
$message : string
Tags
throws
ValidationException
Return values
Validator

assertNullable()

Assert that the callback returns true for each variable.

public assertNullable(callable(string): bool $callback, string $message) : Validator

Skip checking null variable values.

Parameters
$callback : callable(string): bool
$message : string
Tags
throws
ValidationException
Return values
Validator

        
On this page

Search results