E-Mail validation.

Supports following options:

- disallow_tld   (array)  Optional, list of top level domains to disallow
- disallow_host  (array)  Optional, list of hosts to disallow
- mx_check       (bool)   Optional, flag to check DNS records for MX type

Usage:

$validator = cValidatorFactory::getInstance('email');
if ($validator->isValid('user@contenido.org')) {
    // email is valid
} else {
    $errors = $validator->getErrors();
    foreach ($errors as $pos => $errItem) {
        echo $errItem->code . ": " . $errItem->message . "\n";
    }
}
package CONTENIDO Validator

 Methods

Constructor function, sets some predefined options

__construct() 

Returns list of validations errors

getErrors() : array
Inherited
inherited_from \cValidatorAbstract::getErrors()

Returns

array

Option getter.

getOption(string $name) : mixed | null
Inherited
inherited_from \cValidatorAbstract::getOption()

Parameters

$name

string

Returns

mixednull

Validates the passed value.

isValid(mixed $value) : bool
Inherited
inherited_from \cValidatorAbstract::isValid()

Parameters

$value

mixed

Returns

bool

Unsets filter variable function state

resetFilterVarExists() 
Static

Filter variable function exists setter

setFilterVarExists(bool $exists) 
Static

Parameters

$exists

bool

Single option setter.

setOption(string $name, mixed $value) 
Inherited
inherited_from \cValidatorAbstract::setOption()

Parameters

$name

string

$value

mixed

Options setter, merges passed options with previous set options.

setOptions(array $options) 
Inherited
inherited_from \cValidatorAbstract::setOptions()

Parameters

$options

array

Abstract isValid method, which has to be implemented by childs

_isValid(mixed $value) : bool

Parameters

$value

mixed

Returns

bool

Adds a error.

addError(string $message, mixed $code) 
Inherited
inherited_from \cValidatorAbstract::addError()

Parameters

$message

string

$code

mixed

Check DNS Records for MX type.

_checkMx(string $host) : bool

Parameters

$host

string

Host name

Returns

bool

 Properties

 

$_errors : array
Inherited
inherited_from \cValidatorAbstract::$$_errors
 

$_filterVarExists : bool
 

$_options : array
Inherited
inherited_from \cValidatorAbstract::$$_options