Email rule checks if a valid email address is entered.

The following arguments are supported: - (boolean)'checkDns': Performs DNS lookup

category Formagic
package Rule
author Marc Schrader
author Florian Sonnenburg
copyright Copyright (c) 2007-2011 Florian Sonnenburg
version $Id: Email.php 169 2012-05-06 20:16:16Z meweasle $

 Methods

Constructor

__construct(array $arguments) 
Inherited

The default error message that is displayed if the rule is violated can be overwritten by $errorMessage.

see \self::_init()
inherited_from \Formagic_Rule_Abstract::__construct()

Parameters

$arguments

array

The rule options.

Returns translated error message of rule

getMessage() : string
Inherited

inherited_from \Formagic_Rule_Abstract::getMessage()

Returns

stringMessage string

Returns rule type identification string.

getName() : string
Inherited

inherited_from \Formagic_Rule_Abstract::getName()

Returns

stringThe rule name

Sets the error message property.

setMessage(mixed $message) : \Formagic_Rule_Abstract
Inherited

Usually a rule will have one error message string that is used if the validation fails. If neccessary, Formagic_Rule_Abstract::_errorMessage can hold other variables, eg. an array of error messages for different outcomes of the validation process.

Implements a fluent interface pattern.

see \Formagic_Rule_Abstract::__construct()
inherited_from \Formagic_Rule_Abstract::setMessage()

Parameters

$message

mixed

The error message value.

Returns

Performs rule check

validate(string $value) : boolean

Subclasses have to implement their behavior here.

Parameters

$value

string

Item value object to be validated

Returns

booleanTrue if the item value is email formatted

Initializes email rule.

_init(array $arguments) : void

Supported keys:

checkDns:
Boolean flag to decide if a DNS lookup for the given mail domain is performed with the validation
validationStrategy:
Implementation of Formagic_Rule_EmailValidation_Interface that decides if a mail address is valid.

Parameters

$arguments

array

Array of arguments

Exceptions

\Formagic_Exception If given validationStrategy is not valid

Checks if value is not entered by a user or if the field has not been assigned to the form.

_isNoUserValue(\$value $value) : boolean
Inherited

The value 0 (zero) for example could be something the user entered willingly and would be skipped from rule checks when using empty().

inherited_from \Formagic_Rule_Abstract::_isNoUserValue()

Parameters

$value

\$value

mixed Value to be checked

Returns

boolean

Returns validation provider for the item.

_getValidationStrategy() : \Formagic_Rule_EmailValidation_Interface

Defaults to Formagic_Rule_EmailValidation_PhpFilter if PHP version suffices, or to more expensive Formagic_Rule_EmailValidation_Regex if not.

Returns

 Properties

 

Default error message

$_message : string

 

Defines if reverse lookup of mail domain DNS is executed

$_checkDns : boolean

 

Rule type identifier.

$_name : string
Inherited

inherited_from \Formagic_Rule_Abstract::$$_name
 

Validation strategy

$_validationStrategy : \Formagic_Rule_Email_ValidationInterface