public static function isDomain($domain)
    {
        if (!is_string($domain)) {
            throw new \ErrorException('Accept string ' . gettype($domain) . ' given');
        }

        return  (bool) preg_match(
            '/^((https?|ftps?|ssl|url|git):\/\/)?[a-zA-Z0-9-_.]+\.[a-z]{2,6}$/',
            $domain
        );
    }
public static function isDomain($domain)
    {
        if (!is_string($domain)) {
            throw new \ErrorException('Accept string ' . gettype($domain) . ' given');
        }

        return  (bool) preg_match(
            '/^((https?|ftps?|ssl|url|git):\/\/)?[a-zA-Z0-9-_.]+\.[a-z]{2,6}$/',
            $domain
        );
    }
public static function isDomain ( $ domain ) { if ( ! is_string ( $ domain ) ) { throw new \ ErrorException ( 'Accept string ' . gettype ( $ domain ) . ' given' ) ; } return ( bool ) preg_match ( '/^((https?|ftps?|ssl|url|git):\/\/)?[a-zA-Z0-9-_.]+\.[a-z]{2,6}$/' , $ domain ) ; }
Check if the string is a domain

eg: http://exemple.com => true
eg: http:/exemple.com => false

@param string $domain

@return bool
@throws \ErrorException
Check if the string is a domain