src/Swot.php
public function isAcademic($text)
    {
        if (empty($text)) {
            return false;
        }

        $domain = $this->getDomain($text);

        if ($domain === null) {
            return false;
        }

        foreach ($this->getBlacklistedTopLevelDomains() as $blacklistedDomain) {
            $name = (string) $domain['host'];

            if (preg_match('/' . preg_quote($blacklistedDomain) . '$/', $name)) {
                return false;
            }
        }

        if (in_array($domain['tld'], $this->getAcademicTopLevelDomains())) {
            return true;
        }

        if ($this->matchesAcademicDomain($domain)) {
            return true;
        }

        return false;
    }
public function isAcademic($text)
    {
        if (empty($text)) {
            return false;
        }

        $domain = $this->getDomain($text);

        if ($domain === null) {
            return false;
        }

        foreach ($this->getBlacklistedTopLevelDomains() as $blacklistedDomain) {
            $name = (string) $domain['host'];

            if (preg_match('/' . preg_quote($blacklistedDomain) . '$/', $name)) {
                return false;
            }
        }

        if (in_array($domain['tld'], $this->getAcademicTopLevelDomains())) {
            return true;
        }

        if ($this->matchesAcademicDomain($domain)) {
            return true;
        }

        return false;
    }
public function isAcademic ( $ text ) { if ( empty ( $ text ) ) { return false ; } $ domain = $ this -> getDomain ( $ text ) ; if ( $ domain === null ) { return false ; } foreach ( $ this -> getBlacklistedTopLevelDomains ( ) as $ blacklistedDomain ) { $ name = ( string ) $ domain [ 'host' ] ; if ( preg_match ( '/' . preg_quote ( $ blacklistedDomain ) . '$/' , $ name ) ) { return false ; } } if ( in_array ( $ domain [ 'tld' ] , $ this -> getAcademicTopLevelDomains ( ) ) ) { return true ; } if ( $ this -> matchesAcademicDomain ( $ domain ) ) { return true ; } return false ; }
Determines whether or not an email address or domain is
part of a higher-education institution.

@param  string $text Email address or domain name
@return bool   true if academic, false otherwise
Determines whether or not an email address or domain is part of a higher - education institution .