public static function specifyType($domain)
    {
        if (false !== filter_var($domain, FILTER_VALIDATE_IP)) {
            return new IPAddress($domain);
        }

        return new Hostname($domain);
    }
public static function specifyType($domain)
    {
        if (false !== filter_var($domain, FILTER_VALIDATE_IP)) {
            return new IPAddress($domain);
        }

        return new Hostname($domain);
    }
public static function specifyType ( $ domain ) { if ( false !== filter_var ( $ domain , FILTER_VALIDATE_IP ) ) { return new IPAddress ( $ domain ) ; } return new Hostname ( $ domain ) ; }
Returns a Hostname or a IPAddress object depending on passed value

@param $domain
@return Hostname|IPAddress
Returns a Hostname or a IPAddress object depending on passed value