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
$repository
The environment repository instance.
private
RepositoryInterface
$repository
$variables
The variables to validate.
private
array<string|int, string>
$variables
Methods
__construct()
Create a new validator instance.
public
__construct(RepositoryInterface $repository, array<string|int, string> $variables) : void
Parameters
- $repository : RepositoryInterface
- $variables : array<string|int, string>
allowedRegexValues()
Assert that each variable matches the given regular expression.
public
allowedRegexValues(string $regex) : Validator
Parameters
- $regex : string
Tags
Return values
ValidatorallowedValues()
Assert that each variable is amongst the given choices.
public
allowedValues(array<string|int, string> $choices) : Validator
Parameters
- $choices : array<string|int, string>
Tags
Return values
Validatorassert()
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
Return values
ValidatorassertNullable()
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
Return values
ValidatorisBoolean()
Assert that each specified variable is a boolean.
public
isBoolean() : Validator
Tags
Return values
ValidatorisInteger()
Assert that each specified variable is an integer.
public
isInteger() : Validator
Tags
Return values
ValidatornotEmpty()
Assert that each variable is not empty.
public
notEmpty() : Validator
Tags
Return values
Validatorrequired()
Assert that each variable is present.
public
required() : Validator