Zend\Validator\EmailAddress
Synopsis
class EmailAddress
extends AbstractValidator
{
- // constants
- const INVALID = 'emailAddressInvalid';
- const INVALID_FORMAT = 'emailAddressInvalidFormat';
- const INVALID_HOSTNAME = 'emailAddressInvalidHostname';
- const INVALID_MX_RECORD = 'emailAddressInvalidMxRecord';
- const INVALID_SEGMENT = 'emailAddressInvalidSegment';
- const DOT_ATOM = 'emailAddressDotAtom';
- const QUOTED_STRING = 'emailAddressQuotedString';
- const INVALID_LOCAL_PART = 'emailAddressInvalidLocalPart';
- const LENGTH_EXCEEDED = 'emailAddressLengthExceeded';
- // members
- protected array $messageTemplates;
- protected array $messageVariables;
- protected string $hostname;
- protected string $localPart;
- protected array $mxRecord;
- protected array $options;
- // Inherited members from AbstractValidator
- protected mixed $value;
- protected TranslatorInterface $defaultTranslator;
- protected string $defaultTranslatorTextDomain;
- protected integer $messageLength;
- protected array $abstractOptions;
- // methods
- public void __construct()
- public AbstractValidator setMessage()
- public Hostname getHostnameValidator()
- public EmailAddress setHostnameValidator()
- public int getAllow()
- public EmailAddress setAllow()
- public bool isMxSupported()
- public bool getMxCheck()
- public EmailAddress useMxCheck()
- public bool getDeepMxCheck()
- public EmailAddress useDeepMxCheck()
- public bool getDomainCheck()
- public EmailAddress useDomainCheck()
- protected bool isReserved()
- protected bool validateLocalPart()
- public array getMXRecord()
- protected bool validateMXRecords()
- protected bool validateHostnamePart()
- protected bool splitEmailParts()
- public bool isValid()
- // Inherited methods from AbstractValidator
- public void __construct()
- public mixed getOption()
- public array getOptions()
- public AbstractValidator setOptions()
- public array getMessages()
- public bool __invoke()
- public array getMessageVariables()
- public array getMessageTemplates()
- public AbstractValidator setMessage()
- public AbstractValidator setMessages()
- public mixed __get()
- protected string createMessage()
- protected void error()
- protected mixed getValue()
- protected void setValue()
- public AbstractValidator setValueObscured()
- public bool isValueObscured()
- public AbstractValidator setTranslator()
- public TranslatorInterface|null getTranslator()
- public bool hasTranslator()
- public AbstractValidator setTranslatorTextDomain()
- public string getTranslatorTextDomain()
- public static void setDefaultTranslator()
- public static TranslatorInterface|null getDefaultTranslator()
- public static bool hasDefaultTranslator()
- public static void setDefaultTranslatorTextDomain()
- public static string getDefaultTranslatorTextDomain()
- public AbstractValidator setTranslatorEnabled()
- public bool isTranslatorEnabled()
- public static int getMessageLength()
- public static void setMessageLength()
- protected string translateMessage()
Hierarchy
Extends
Constants
Name | Value |
---|---|
INVALID | 'emailAddressInvalid' |
INVALID_FORMAT | 'emailAddressInvalidFormat' |
INVALID_HOSTNAME | 'emailAddressInvalidHostname' |
INVALID_MX_RECORD | 'emailAddressInvalidMxRecord' |
INVALID_SEGMENT | 'emailAddressInvalidSegment' |
DOT_ATOM | 'emailAddressDotAtom' |
QUOTED_STRING | 'emailAddressQuotedString' |
INVALID_LOCAL_PART | 'emailAddressInvalidLocalPart' |
LENGTH_EXCEEDED | 'emailAddressLengthExceeded' |
Members
protected
- $abstractOptions
- $defaultTranslator
—
Zend\Validator\Translator\TranslatorInterface
Default translation object for all validate objects - $defaultTranslatorTextDomain
—
string
Default text domain to be used with translator - $hostname — string
- $localPart — string
- $messageLength
—
int
Limits the maximum returned length of an error message - $messageTemplates — array
- $messageVariables — array
- $mxRecord
—
array
Returns the found mx record informations -
$options
Internal options array - $value
—
mixed
The value to be validated
Methods
protected
- isReserved() — Returns if the given host is reserved
- splitEmailParts() — Splits the given value in hostname and local part of the email address
- validateHostnamePart() — Internal method to validate the hostname part of the email address
- validateLocalPart() — Internal method to validate the local part of the email address
- validateMXRecords() — Internal method to validate the servers MX records
public
- __construct() — Instantiates hostname validator for local use
- getAllow() — Returns the allow option of the attached hostname validator
- getDeepMxCheck() — Returns the set deepMxCheck option
- getDomainCheck() — Returns the set domainCheck option
- getHostnameValidator() — Returns the set hostname validator
- getMXRecord() — Returns the found MX Record information after validation including weight for further processing
- getMxCheck() — Returns the set validateMx option
- isMxSupported() — Whether MX checking via getmxrr is supported or not
- isValid() — Defined by Zend\Validator\ValidatorInterface
- setAllow() — Sets the allow option of the hostname validator to use
- setHostnameValidator()
- setMessage() — Sets the validation failure message template for a particular key Adds the ability to set messages to the attached hostname validator
- useDeepMxCheck() — Use deep validation for MX records
- useDomainCheck() — Sets if the domain should also be checked or only the local part of the email address
- useMxCheck() — Set whether we check for a valid MX record via DNS
Inherited from Zend\Validator\AbstractValidator
protected
- createMessage() — Constructs and returns a validation failure message with the given message key and value.
- error()
- getValue() — Returns the validation value
- setValue() — Sets the value to be validated and clears the messages and errors arrays
- translateMessage() — Translate a validation message
public
- __get() — Magic function returns the value of the requested property, if and only if it is the value or a message variable.
- __invoke() — Invoke as command
- getDefaultTranslator() — Get default translation object for all validate objects
- getDefaultTranslatorTextDomain() — Get default translation text domain for all validate objects
- getMessageLength() — Returns the maximum allowed message length
- getMessageTemplates() — Returns the message templates from the validator
- getMessageVariables() — Returns an array of the names of variables that are used in constructing validation failure messages
- getMessages() — Returns array of validation failure messages
- getOption() — Returns an option
- getOptions() — Returns all available options
- getTranslator() — Return translation object
- getTranslatorTextDomain() — Return the translation text domain
- hasDefaultTranslator() — Is there a default translation object set?
- hasTranslator() — Does this validator have its own specific translator?
- isTranslatorEnabled() — Is translation enabled?
- isValueObscured() — Retrieve flag indicating whether or not value should be obfuscated in messages
- setDefaultTranslator() — Set default translation object for all validate objects
- setDefaultTranslatorTextDomain() — Set default translation text domain for all validate objects
- setMessage() — Sets the validation failure message template for a particular key
- setMessageLength() — Sets the maximum allowed message length
- setMessages() — Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings.
- setOptions() — Sets one or multiple options
- setTranslator() — Set translation object
- setTranslatorEnabled() — Indicate whether or not translation should be enabled
- setTranslatorTextDomain() — Set translation text domain
- setValueObscured() — Set flag indicating whether or not value should be obfuscated in messages