class UniqueUserEmailValidator extends EmailValidator implements ValidatorForSubjectInterface (View source)

Validate the length of a string.

Constants

E_INVALID_ADDRESS

The email address is not valid.

E_EMAIL_IN_USE

The email address is already in use.

E_EMAIL_USED_BY_ANOTHER_USER

The email address is already in use by another user.

Properties

protected array $translatable_requirements from  AbstractTranslatableValidator
protected array $translatable_errors from  AbstractTranslatableValidator
protected bool $testMXRecord

Should we test the MX record to see if the domain is valid?

from  EmailValidator
protected bool $strict

Should email address warnings be considered as errors?

from  EmailValidator
private EmailValidator|null $eguliasEmailValidator

The instance of Egulias\EmailValidator to be used.

from  EmailValidator
protected Connection $connection

The connection to the database.

Methods

setRequirementString(int $code, string|Closure $message)

Set the requirement string to a mixed value.

setErrorString(int $code, string|Closure $message)

Set the error string to a string or to a closure.

string[]
getRequirementStrings()

Get the validator requirements in the form of an array keyed by it's respective error code.

string|mixed
getErrorString(int $code, mixed $value, mixed $default = null)

Get an error string given a code and a passed value.

bool
isTranslatableStringValueValid(Closure|string|mixed $value)

Check to see if $value a valid stand in for a translatable string.

__construct(bool $testMXRecord = false, bool $strict = false, Connection $connection)

UniqueUserEmailValidator constructor.

bool
isTestMXRecord()

Should we test the MX record to see if the domain is valid?

$this
setTestMXRecord(bool $testMXRecord)

Should we test the MX record to see if the domain is valid?

bool
isStrict()

Should email address warnings be considered as errors?

$this
setStrict(bool $strict)

Should email address warnings be considered as errors?

bool
isValid(mixed $mixed, ArrayAccess $error = null)

Is this mixed value valid.

bool
checkEmail(string|mixed $mixed)

Actually check if an email address is valid.

EmailValidator
getEguliasEmailValidator()

Get the instance of Egulias\EmailValidator to be used.

bool
isValidFor(mixed $mixed, mixed $subject = null, ArrayAccess $error = null)

Is this mixed value valid for the specified (optional) subject?

Details

setRequirementString(int $code, string|Closure $message)

Set the requirement string to a mixed value.

Parameters

int $code

The error code

string|Closure $message

Either a plain string, or a closure that returns a string

See also

TranslatableValidatorInterface::setRequirementString

setErrorString(int $code, string|Closure $message)

Set the error string to a string or to a closure.

Parameters

int $code

The error code

string|Closure $message

Either a plain string, or a closure that returns a string

See also

TranslatableValidatorInterface::setErrorString

string[] getRequirementStrings()

Get the validator requirements in the form of an array keyed by it's respective error code.

Return Value

string[]

See also

ValidatorInterface::getRequirementStrings

protected string|mixed getErrorString(int $code, mixed $value, mixed $default = null)

Get an error string given a code and a passed value.

Parameters

int $code
mixed $value
mixed $default

Return Value

string|mixed

Returns a string or $default

protected bool isTranslatableStringValueValid(Closure|string|mixed $value)

Check to see if $value a valid stand in for a translatable string.

Parameters

Closure|string|mixed $value

Return Value

bool

__construct(bool $testMXRecord = false, bool $strict = false, Connection $connection)

UniqueUserEmailValidator constructor.

Parameters

bool $testMXRecord

Should we test the MX record to see if the domain is valid?

bool $strict

Should email address warnings be considered as errors?

Connection $connection

bool isTestMXRecord()

Should we test the MX record to see if the domain is valid?

Return Value

bool

$this setTestMXRecord(bool $testMXRecord)

Should we test the MX record to see if the domain is valid?

Parameters

bool $testMXRecord

Return Value

$this

bool isStrict()

Should email address warnings be considered as errors?

Return Value

bool

$this setStrict(bool $strict)

Should email address warnings be considered as errors?

Parameters

bool $strict

Return Value

$this

bool isValid(mixed $mixed, ArrayAccess $error = null)

Is this mixed value valid.

Parameters

mixed $mixed

Can be any value

ArrayAccess $error

Return Value

bool

Exceptions

InvalidArgumentException

See also

ValidatorInterface::isValid

protected bool checkEmail(string|mixed $mixed)

Actually check if an email address is valid.

Parameters

string|mixed $mixed

Return Value

bool

private EmailValidator getEguliasEmailValidator()

Get the instance of Egulias\EmailValidator to be used.

This is private because in future we may switch to another library.

Return Value

EmailValidator

bool isValidFor(mixed $mixed, mixed $subject = null, ArrayAccess $error = null)

Is this mixed value valid for the specified (optional) subject?

Parameters

mixed $mixed

Can be any value

mixed $subject

The subject the value should be valid for

ArrayAccess $error

Return Value

bool

Exceptions

InvalidArgumentException

See also

ValidatorForSubjectInterface::isValidFor