EmailValidator
class EmailValidator extends AbstractTranslatableValidator (View source)
Validate the length of a string.
Constants
E_INVALID_ADDRESS |
The email address is not valid. |
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? |
|
protected bool | $strict | Should email address warnings be considered as errors? |
|
private EmailValidator|null | $eguliasEmailValidator | The instance of Egulias\EmailValidator to be used. |
Methods
Set the requirement string to a mixed value.
Set the error string to a string or to a closure.
Get the validator requirements in the form of an array keyed by it's respective error code.
Get an error string given a code and a passed value.
Check to see if $value a valid stand in for a translatable string.
EmailValidator constructor.
Should we test the MX record to see if the domain is valid?
Should we test the MX record to see if the domain is valid?
Should email address warnings be considered as errors?
Should email address warnings be considered as errors?
Actually check if an email address is valid.
Get the instance of Egulias\EmailValidator to be used.
Details
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.
protected string|mixed
getErrorString(int $code, mixed $value, mixed $default = null)
Get an error string given a code and a passed value.
protected 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)
EmailValidator 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.
protected bool
checkEmail(string|mixed $mixed)
Actually check if an email address is valid.
private EmailValidator
getEguliasEmailValidator()
Get the instance of Egulias\EmailValidator to be used.
This is private because in future we may switch to another library.