package Default
inherited_from \Zend\Validator\AbstractValidator

 Methods

Instantiates hostname validator for local use

__construct(array|\Traversable $options = array()

The following additional option keys are supported: 'hostnameValidator' => A hostname validator, see Zend\Validator\Hostname 'allow' => Options for the hostname validator, see Zend\Validator\Hostname::ALLOW_* 'useMxCheck' => If MX check should be enabled, boolean 'useDeepMxCheck' => If a deep MX check should be done, boolean

inherited_from \Zend\Validator\AbstractValidator::__construct()

Parameters

$options

array\Traversable

OPTIONAL

Abstract constructor for all validators A validator should accept following parameters: - nothing f.e. Validator() - one or multiple scalar values f.e. Validator($first, $second, $third) - an array f.e. Validator(array($first => 'first', $second => 'second', $third => 'third')) - an instance of Traversable f.e. Validator($config_instance)

__construct(array|\Traversable $options = null
Inherited

Parameters

$options

array\Traversable

Magic function returns the value of the requested property, if and only if it is the value or a message variable.

__get(string $property) : mixed
Inherited

Parameters

$property

string

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

mixed

Invoke as command

__invoke(mixed $value) : boolean
Inherited

Parameters

$value

mixed

Returns

boolean

Returns the allow option of the attached hostname validator

getAllow() : integer

Returns

integer

Returns the set deepMxCheck option

getDeepMxCheck() : boolean

Returns

boolean

Get default translation object for all validate objects

getDefaultTranslator() : \Zend\Validator\Translator\TranslatorInterface | null
InheritedStatic

Returns

\Zend\Validator\Translator\TranslatorInterfacenull

Get default translation text domain for all validate objects

getDefaultTranslatorTextDomain() : string
InheritedStatic

Returns

string

Returns the set domainCheck option

getDomainCheck() : boolean

Returns

boolean

Returns the set hostname validator

getHostnameValidator() : \Zend\Validator\Hostname

If was not previously set then lazy load a new one

Returns

\Zend\Validator\Hostname

Returns the found MX Record information after validation including weight for further processing

getMXRecord() : array

Returns

array

Returns the maximum allowed message length

getMessageLength() : integer
InheritedStatic

Returns

integer

Returns the message templates from the validator

getMessageTemplates() : array
Inherited

Returns

array

Returns an array of the names of variables that are used in constructing validation failure messages

getMessageVariables() : array
Inherited

Returns

array

Returns array of validation failure messages

getMessages() : array
Inherited

If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.

inherited_from \Zend\Validator\ValidatorInterface::getMessages()

Returns

array

Returns the set validateMx option

getMxCheck() : boolean

Returns

boolean

Returns an option

getOption(string $option) : mixed
Inherited

Parameters

$option

string

Option to be returned

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

mixedReturned option

Returns all available options

getOptions() : array
Inherited

Returns

arrayArray with all available options

Return translation object

getTranslator() : \Zend\Validator\Translator\TranslatorInterface | null
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::getTranslator()

Returns

\Zend\Validator\Translator\TranslatorInterfacenull

Return the translation text domain

getTranslatorTextDomain() : string
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::getTranslatorTextDomain()

Returns

string

Is there a default translation object set?

hasDefaultTranslator() : boolean
InheritedStatic

Returns

boolean

Does this validator have its own specific translator?

hasTranslator() : boolean
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::hasTranslator()

Returns

boolean

Whether MX checking via getmxrr is supported or not

isMxSupported() : boolean

Returns

boolean

Is translation enabled?

isTranslatorEnabled() : boolean
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::isTranslatorEnabled()

Returns

boolean

Defined by Zend\Validator\ValidatorInterface

isValid(string $value) : boolean

Returns true if and only if $value is a valid email address according to RFC2822

link RFC2822
link US-ASCII characters

Parameters

$value

string

Returns

boolean

Retrieve flag indicating whether or not value should be obfuscated in messages

isValueObscured() : boolean
Inherited

Returns

boolean

Sets the allow option of the hostname validator to use

setAllow(integer $allow) : \Zend\Validator\EmailAddress

Parameters

$allow

integer

Returns

\Zend\Validator\EmailAddressProvides a fluent interface

Set default translation object for all validate objects

setDefaultTranslator(\Zend\Validator\Translator\TranslatorInterface|null $translator = null, string $textDomain = null) : void
InheritedStatic

Parameters

$translator

\Zend\Validator\Translator\TranslatorInterfacenull

$textDomain

string

(optional)

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Set default translation text domain for all validate objects

setDefaultTranslatorTextDomain(string $textDomain = 'default') : void
InheritedStatic

Parameters

$textDomain

string

setHostnameValidator()

setHostnameValidator(\Zend\Validator\Hostname $hostnameValidator = null) : \Zend\Validator\EmailAddress

Parameters

$hostnameValidator

\Zend\Validator\Hostname

OPTIONAL

Returns

\Zend\Validator\EmailAddressProvides a fluent interface

Sets the validation failure message template for a particular key Adds the ability to set messages to the attached hostname validator

setMessage(string $messageString, string $messageKey = null) : \Zend\Validator\AbstractValidator
inherited_from \Zend\Validator\AbstractValidator::setMessage()

Parameters

$messageString

string

$messageKey

string

OPTIONAL

Returns

\Zend\Validator\AbstractValidatorProvides a fluent interface

Sets the validation failure message template for a particular key

setMessage(string $messageString, string $messageKey = null) : \Zend\Validator\AbstractValidator
Inherited

Parameters

$messageString

string

$messageKey

string

OPTIONAL

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

\Zend\Validator\AbstractValidatorProvides a fluent interface

Sets the maximum allowed message length

setMessageLength(integer $length = -1
InheritedStatic

Parameters

$length

integer

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.

setMessages(array $messages) : \Zend\Validator\AbstractValidator
Inherited

Parameters

$messages

array

Returns

\Zend\Validator\AbstractValidator

Sets one or multiple options

setOptions(array|\Traversable $options = array()) : \Zend\Validator\AbstractValidator
Inherited

Parameters

$options

array\Traversable

Options to set

Exceptions

\Zend\Validator\Exception\InvalidArgumentException If $options is not an array or Traversable

Returns

\Zend\Validator\AbstractValidatorProvides fluid interface

Set translation object

setTranslator(\Zend\Validator\Translator\TranslatorInterface|null $translator = null, string $textDomain = null) : \Zend\Validator\AbstractValidator
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::setTranslator()

Parameters

$translator

\Zend\Validator\Translator\TranslatorInterfacenull

$textDomain

string

(optional)

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

\Zend\Validator\AbstractValidator

Indicate whether or not translation should be enabled

setTranslatorEnabled(boolean $flag = true) : \Zend\Validator\AbstractValidator
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::setTranslatorEnabled()

Parameters

$flag

boolean

Returns

\Zend\Validator\AbstractValidator

Set translation text domain

setTranslatorTextDomain(string $textDomain = 'default') : \Zend\Validator\AbstractValidator
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::setTranslatorTextDomain()

Parameters

$textDomain

string

Returns

\Zend\Validator\AbstractValidator

Set flag indicating whether or not value should be obfuscated in messages

setValueObscured(boolean $flag) : \Zend\Validator\AbstractValidator
Inherited

Parameters

$flag

boolean

Returns

\Zend\Validator\AbstractValidator

Use deep validation for MX records

useDeepMxCheck(boolean $deep) : \Zend\Validator\EmailAddress

Parameters

$deep

boolean

Set deep to true to perform a deep validation process for MX records

Returns

\Zend\Validator\EmailAddressFluid Interface

Sets if the domain should also be checked or only the local part of the email address

useDomainCheck(boolean $domain = true) : \Zend\Validator\EmailAddress

Parameters

$domain

boolean

Returns

\Zend\Validator\EmailAddressFluid Interface

Set whether we check for a valid MX record via DNS

useMxCheck(boolean $mx) : \Zend\Validator\EmailAddress

This only applies when DNS hostnames are validated

Parameters

$mx

boolean

Set allowed to true to validate for MX records, and false to not validate them

Returns

\Zend\Validator\EmailAddressFluid Interface

Constructs and returns a validation failure message with the given message key and value.

createMessage(string $messageKey, string|array|object $value) : string
Inherited

Returns null if and only if $messageKey does not correspond to an existing template.

If a translator is available and a translation exists for $messageKey, the translation will be used.

Parameters

$messageKey

string

$value

stringarrayobject

Returns

string

error()

error(string $messageKey, string $value = null) : void
Inherited

Parameters

$messageKey

string

$value

string

OPTIONAL

Returns the validation value

getValue() : mixed
Inherited

Returns

mixedValue to be validated

Safely convert UTF-8 encoded domain name to ASCII

idnToAscii(string $email) : string

Parameters

$email

string

the UTF-8 encoded email

Returns

string

Safely convert ASCII encoded domain name to UTF-8

idnToUtf8(string $email) : string

Parameters

$email

string

the ASCII encoded email

Returns

string

Returns if the given host is reserved

isReserved(string $host) : boolean

The following addresses are seen as reserved '0.0.0.0/8', '10.0.0.0/8', '127.0.0.0/8' '100.64.0.0/10' '172.16.0.0/12' '198.18.0.0/15' '169.254.0.0/16', '192.168.0.0/16' '192.0.2.0/24', '192.88.99.0/24', '198.51.100.0/24', '203.0.113.0/24' '224.0.0.0/4', '240.0.0.0/4'

see As of RFC5753 (JAN 2010), the following blocks are no longer reserved: - 128.0.0.0/16 - 191.255.0.0/16 - 223.255.255.0/24
see As of RFC6598 (APR 2012), the following blocks are now reserved: - 100.64.0.0/10
see

Parameters

$host

string

Returns

booleanReturns false when minimal one of the given addresses is not reserved

Sets the value to be validated and clears the messages and errors arrays

setValue(mixed $value) : void
Inherited

Parameters

$value

mixed

Splits the given value in hostname and local part of the email address

splitEmailParts(string $value) : boolean

Parameters

$value

string

Email address to be split

Returns

booleanReturns false when the email can not be split

Translate a validation message

translateMessage(string $messageKey, string $message) : string
Inherited

Parameters

$messageKey

string

$message

string

Returns

string

Internal method to validate the hostname part of the email address

validateHostnamePart() : boolean

Returns

boolean

Internal method to validate the local part of the email address

validateLocalPart() : boolean

Returns

boolean

Internal method to validate the servers MX records

validateMXRecords() : boolean

Returns

boolean

 Properties

 

$abstractOptions

$abstractOptions 

Default

array('messages' => array(), 'messageTemplates' => array(), 'messageVariables' => array(), 'translator' => null, 'translatorTextDomain' => null, 'translatorEnabled' => true, 'valueObscured' => false)
 

Default translation object for all validate objects

$defaultTranslator : \Zend\Validator\Translator\TranslatorInterface

Default

Static
 

Default text domain to be used with translator

$defaultTranslatorTextDomain : string

Default

'default'
Static
 

$hostname

$hostname : string

Default

 

$localPart

$localPart : string

Default

 

Limits the maximum returned length of an error message

$messageLength : integer

Default

-1
Static
 

$messageTemplates

$messageTemplates : array

Default

array(self::INVALID => "Invalid type given. String expected", self::INVALID_FORMAT => "The input is not a valid email address. Use the basic format local-part@hostname", self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for the email address", self::INVALID_MX_RECORD => "'%hostname%' does not appear to have any valid MX or A records for the email address", self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address should not be resolved from public network", self::DOT_ATOM => "'%localPart%' can not be matched against dot-atom format", self::QUOTED_STRING => "'%localPart%' can not be matched against quoted-string format", self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for the email address", self::LENGTH_EXCEEDED => "The input exceeds the allowed length")
 

$messageVariables

$messageVariables : array

Default

array('hostname' => 'hostname', 'localPart' => 'localPart')
 

Returns the found mx record informations

$mxRecord : array

Default

 

Internal options array

$options 

Default

array('useMxCheck' => false, 'useDeepMxCheck' => false, 'useDomainCheck' => true, 'allow' => \Zend\Validator\Hostname::ALLOW_DNS, 'hostnameValidator' => null)
 

The value to be validated

$value : mixed

Default

 Constants

 

DOT_ATOM

DOT_ATOM = 'emailAddressDotAtom' 
 

INVALID

INVALID = 'emailAddressInvalid' 
 

INVALID_FORMAT

INVALID_FORMAT = 'emailAddressInvalidFormat' 
 

INVALID_HOSTNAME

INVALID_HOSTNAME = 'emailAddressInvalidHostname' 
 

INVALID_LOCAL_PART

INVALID_LOCAL_PART = 'emailAddressInvalidLocalPart' 
 

INVALID_MX_RECORD

INVALID_MX_RECORD = 'emailAddressInvalidMxRecord' 
 

INVALID_SEGMENT

INVALID_SEGMENT = 'emailAddressInvalidSegment' 
 

LENGTH_EXCEEDED

LENGTH_EXCEEDED = 'emailAddressLengthExceeded' 
 

QUOTED_STRING

QUOTED_STRING = 'emailAddressQuotedString'