Methods

Instantiates hostname validator for local use

__construct(array | \Traversable $options) 

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

Parameters

$options

array\Traversable

OPTIONAL

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

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

Parameters

$property

string

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

mixed

Invoke as command

__invoke(mixed $value) : bool
Inherited

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

Parameters

$value

mixed

Returns

bool

Returns the allow option of the attached hostname validator

getAllow() : integer

Returns

integer

Returns the set deepMxCheck option

getDeepMxCheck() : bool

Returns

bool

Get default translation object for all validate objects

getDefaultTranslator() : \Zend\I18n\Translator\Translator | null
Inherited

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

Returns

Get default translation text domain for all validate objects

getDefaultTranslatorTextDomain() : string
Inherited

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

Returns

string

Returns the set domainCheck option

getDomainCheck() : bool

Returns

bool

Returns the set hostname validator

getHostnameValidator() : \Zend\Validator\Hostname

If was not previously set then lazy load a new one

Returns

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
Inherited

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

Returns

integer

Returns the message templates from the validator

getMessageTemplates() : array
Inherited

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

Returns

array

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

getMessageVariables() : array
Inherited

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

Returns

array

Returns array of validation failure messages

getMessages() : array
Inherited

The array keys are validation failure message identifiers, and the array values are the corresponding human-readable message strings.

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\AbstractValidator::getMessages()

Returns

array

Returns the set validateMx option

getMxCheck() : bool

Returns

bool

Returns an option

getOption(string $option) : mixed
Inherited

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

Parameters

$option

string

Option to be returned

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

mixedReturned option

Returns all available options

getOptions() : array
Inherited

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

Returns

arrayArray with all available options

Return translation object

getTranslator() : \Zend\I18n\Translator\Translator | null
Inherited

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

Returns

Return the translation text domain

getTranslatorTextDomain() : string
Inherited

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

Returns

string

Is there a default translation object set?

hasDefaultTranslator() : bool
Inherited

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

Returns

bool

Does this validator have its own specific translator?

hasTranslator() : bool
Inherited

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

Returns

bool

Whether MX checking via getmxrr is supported or not

isMxSupported() : bool

Returns

bool

Is translation enabled?

isTranslatorEnabled() : bool
Inherited

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

Returns

bool

Defined by Zend\Validator\ValidatorInterface

isValid(string $value) : bool

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

link RFC2822
link US-ASCII characters

Parameters

$value

string

Exceptions

\Zend\Validator\Exception\RuntimeException If validation of $value is impossible

Returns

bool

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

isValueObscured() : bool
Inherited

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

Returns

bool

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\I18n\Translator\Translator $translator, string $textDomain) : void
Inherited

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

Parameters

$textDomain

string

(optional)

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Set default translation text domain for all validate objects

setDefaultTranslatorTextDomain(string $textDomain) : void
Inherited

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

Parameters

$textDomain

string

setHostnameValidator()

setHostnameValidator(\Zend\Validator\Hostname $hostnameValidator) : \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) : \Zend\Validator\AbstractValidator

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) 
Inherited

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

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

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

Parameters

$messages

array

Returns

Sets one or multiple options

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

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

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\I18n\Translator\Translator $translator, string $textDomain) : \Zend\Validator\AbstractValidator
Inherited

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

Parameters

$textDomain

string

(optional)

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

Indicate whether or not translation should be enabled

setTranslatorEnabled(bool $flag) : \Zend\Validator\AbstractValidator
Inherited

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

Parameters

$flag

bool

Returns

Set translation text domain

setTranslatorTextDomain(string $textDomain) : \Zend\Validator\AbstractValidator
Inherited

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

Parameters

$textDomain

string

Returns

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

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

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

Parameters

$flag

bool

Returns

Use deep validation for MX records

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

Parameters

$deep

bool

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

Returns

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

useDomainCheck(bool $domain) : \Zend\Validator\EmailAddress

Parameters

$domain

bool

Returns

Set whether we check for a valid MX record via DNS

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

This only applies when DNS hostnames are validated

Parameters

$mx

bool

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

Returns

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.

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

Parameters

$messageKey

string

$value

stringarrayobject

Returns

string

error()

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

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

Parameters

$messageKey

string

$value

string

OPTIONAL

Returns the validation value

getValue() : mixed
Inherited

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

Returns

mixedValue to be validated

Returns if the given host is reserved

isReserved(string $host) : bool

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 \Zend\Validator\http://en.wikipedia.org/wiki/Reserved_IP_addresses
see \Zend\Validator\http://tools.ietf.org/html/rfc5735#page-6
see \Zend\Validator\http://tools.ietf.org/html/rfc6598#section-7

Parameters

$host

string

Returns

boolReturns 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

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

Parameters

$value

mixed

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

splitEmailParts(string $value) : bool

Parameters

$value

string

Email address to be split

Returns

boolReturns false when the email can not be split

Translate a validation message

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

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

Parameters

$messageKey

string

$message

string

Returns

string

Internal method to validate the hostname part of the email address

validateHostnamePart() : bool

Returns

bool

Internal method to validate the local part of the email address

validateLocalPart() : bool

Returns

bool

Internal method to validate the servers MX records

validateMXRecords() : bool

Returns

bool

 Properties

 

$abstractOptions

$abstractOptions 
Inherited

inherited_from \Zend\Validator\AbstractValidator::$$abstractOptions
 

Default translation object for all validate objects

$defaultTranslator : \Zend\I18n\Translator\Translator
Inherited

inherited_from \Zend\Validator\AbstractValidator::$$defaultTranslator
 

Default text domain to be used with translator

$defaultTranslatorTextDomain : string
Inherited

inherited_from \Zend\Validator\AbstractValidator::$$defaultTranslatorTextDomain
 

$hostname

$hostname : string

 

$localPart

$localPart : string

 

Limits the maximum returned length of a error message

$messageLength : Integer
Inherited

inherited_from \Zend\Validator\AbstractValidator::$$messageLength
 

$messageTemplates

$messageTemplates : array

 

$messageVariables

$messageVariables : array

 

Returns the found mx record informations

$mxRecord : array

 

Internal options array

$options 

 

The value to be validated

$value : mixed
Inherited

inherited_from \Zend\Validator\AbstractValidator::$$value

 Constants

 

DOT_ATOM

DOT_ATOM 

 

INVALID

INVALID 

 

INVALID_FORMAT

INVALID_FORMAT 

 

INVALID_HOSTNAME

INVALID_HOSTNAME 

 

INVALID_LOCAL_PART

INVALID_LOCAL_PART 

 

INVALID_MX_RECORD

INVALID_MX_RECORD 

 

INVALID_SEGMENT

INVALID_SEGMENT 

 

LENGTH_EXCEEDED

LENGTH_EXCEEDED 

 

QUOTED_STRING

QUOTED_STRING