src/Validation/ForbiddenTLD.php
public function validateForbiddenTLD($email, $specifiedTLDs = array()) {

        $forbiddenTLDs = $this->getTheForbiddenTLDs($specifiedTLDs);

        // if no TLD's specified in the parameters; and, no TLD's specified in the config,
        // then deem the validation as kosher
        if (empty($forbiddenTLDs)) return true;

        // initialize var
        $validation = true;

        foreach ($forbiddenTLDs as $forbiddenTLD)
        {
            $lengthOfForbiddenTLD = $this->lengthForbiddenTLD($forbiddenTLD);
            $lastCharactersOfEmail = $this->lastCharactersOfEmail($email, $lengthOfForbiddenTLD);

            // validate
            if ($this->compareEmailWithForbiddenTLD($lastCharactersOfEmail, $forbiddenTLD) )
            {
                $validation = false;
            }
        }

        return $validation;
    }
public function validateForbiddenTLD($email, $specifiedTLDs = array()) {

        $forbiddenTLDs = $this->getTheForbiddenTLDs($specifiedTLDs);

        // if no TLD's specified in the parameters; and, no TLD's specified in the config,
        // then deem the validation as kosher
        if (empty($forbiddenTLDs)) return true;

        // initialize var
        $validation = true;

        foreach ($forbiddenTLDs as $forbiddenTLD)
        {
            $lengthOfForbiddenTLD = $this->lengthForbiddenTLD($forbiddenTLD);
            $lastCharactersOfEmail = $this->lastCharactersOfEmail($email, $lengthOfForbiddenTLD);

            // validate
            if ($this->compareEmailWithForbiddenTLD($lastCharactersOfEmail, $forbiddenTLD) )
            {
                $validation = false;
            }
        }

        return $validation;
    }
public function validateForbiddenTLD ( $ email , $ specifiedTLDs = array ( ) ) { $ forbiddenTLDs = $ this -> getTheForbiddenTLDs ( $ specifiedTLDs ) ; // if no TLD's specified in the parameters; and, no TLD's specified in the config, // then deem the validation as kosher if ( empty ( $ forbiddenTLDs ) ) return true ; // initialize var $ validation = true ; foreach ( $ forbiddenTLDs as $ forbiddenTLD ) { $ lengthOfForbiddenTLD = $ this -> lengthForbiddenTLD ( $ forbiddenTLD ) ; $ lastCharactersOfEmail = $ this -> lastCharactersOfEmail ( $ email , $ lengthOfForbiddenTLD ) ; // validate if ( $ this -> compareEmailWithForbiddenTLD ( $ lastCharactersOfEmail , $ forbiddenTLD ) ) { $ validation = false ; } } return $ validation ; }
Validate Top Level Domains

@param  string $email
@param  array  $specifiedTLDs  So unit test can specify its own array of forbidden TLDs
@return bool
Validate Top Level Domains