EmailValidator\Validator::isExample PHP Method

isExample() public method

As defined in http://tools.ietf.org/html/rfc2606
public isExample ( string $email ) : boolean | null
$email string Address
return boolean | null
    public function isExample($email)
    {
        if (!$this->isEmail($email)) {
            return null;
        }
        $hostname = $this->hostnameFromEmail($email);
        if ($hostname) {
            if (in_array($hostname, $this->exampleDomains)) {
                return true;
            }
            foreach ($this->exampleTlds as $tld) {
                $length = strlen($tld);
                $subStr = substr($hostname, -$length);
                if ($subStr == $tld) {
                    return true;
                }
            }
            return false;
        }
        return null;
    }