MultipleValidationWithAnd
in package
implements
EmailValidation
Table of Contents
Interfaces
Constants
- ALLOW_ALL_ERRORS = 1
- All of validations will be invoked even if one of them got failure.
- STOP_ON_ERROR = 0
- If one of validations fails, the remaining validations will be skipped.
Properties
- $error : MultipleErrors|null
- $mode : int
- $validations : array<string|int, EmailValidation>
- $warnings : array<string|int, mixed>
Methods
- __construct() : mixed
- getError() : InvalidEmail|null
- Returns the validation errors.
- getWarnings() : array<string|int, Warning>
- Returns the validation warnings.
- isValid() : bool
- Returns true if the given email is valid.
- initErrorStorage() : void
- processError() : void
- shouldStop() : bool
Constants
ALLOW_ALL_ERRORS
All of validations will be invoked even if one of them got failure.
public
mixed
ALLOW_ALL_ERRORS
= 1
So MultipleErrors will contain all causes.
STOP_ON_ERROR
If one of validations fails, the remaining validations will be skipped.
public
mixed
STOP_ON_ERROR
= 0
This means MultipleErrors will only contain a single error, the first found.
Properties
$error
private
MultipleErrors|null
$error
$mode
private
int
$mode
$validations
private
array<string|int, EmailValidation>
$validations
= []
$warnings
private
array<string|int, mixed>
$warnings
= []
Methods
__construct()
public
__construct(array<string|int, EmailValidation> $validations[, int $mode = self::ALLOW_ALL_ERRORS ]) : mixed
Parameters
- $validations : array<string|int, EmailValidation>
-
The validations.
- $mode : int = self::ALLOW_ALL_ERRORS
-
The validation mode (one of the constants).
getError()
Returns the validation errors.
public
getError() : InvalidEmail|null
Return values
InvalidEmail|nullgetWarnings()
Returns the validation warnings.
public
getWarnings() : array<string|int, Warning>
Return values
array<string|int, Warning>isValid()
Returns true if the given email is valid.
public
isValid(string $email, EmailLexer $emailLexer) : bool
Parameters
- $email : string
-
The email you want to validate.
- $emailLexer : EmailLexer
-
The email lexer.
Return values
boolinitErrorStorage()
private
initErrorStorage() : void
processError()
private
processError(EmailValidation $validation) : void
Parameters
- $validation : EmailValidation
shouldStop()
private
shouldStop(bool $result) : bool
Parameters
- $result : bool