src/Whois.php
public function getQueryType($query)
    {
        $ipTools = new IpTools;

        if ($ipTools->validIp($query, 'ipv4', false)) {
            if ($ipTools->validIp($query, 'ipv4')) {
                return self::QTYPE_IPV4;
            } else {
                return self::QTYPE_UNKNOWN;
            }
        } elseif ($ipTools->validIp($query, 'ipv6', false)) {
            if ($ipTools->validIp($query, 'ipv6')) {
                return self::QTYPE_IPV6;
            } else {
                return self::QTYPE_UNKNOWN;
            }
        } elseif (!empty($query) && strpos($query, '.') !== false) {
            return self::QTYPE_DOMAIN;
        } elseif (!empty($query) && strpos($query, '.') === false) {
            return self::QTYPE_AS;
        } else {
            return self::QTYPE_UNKNOWN;
        }
    }
public function getQueryType($query)
    {
        $ipTools = new IpTools;

        if ($ipTools->validIp($query, 'ipv4', false)) {
            if ($ipTools->validIp($query, 'ipv4')) {
                return self::QTYPE_IPV4;
            } else {
                return self::QTYPE_UNKNOWN;
            }
        } elseif ($ipTools->validIp($query, 'ipv6', false)) {
            if ($ipTools->validIp($query, 'ipv6')) {
                return self::QTYPE_IPV6;
            } else {
                return self::QTYPE_UNKNOWN;
            }
        } elseif (!empty($query) && strpos($query, '.') !== false) {
            return self::QTYPE_DOMAIN;
        } elseif (!empty($query) && strpos($query, '.') === false) {
            return self::QTYPE_AS;
        } else {
            return self::QTYPE_UNKNOWN;
        }
    }
public function getQueryType ( $ query ) { $ ipTools = new IpTools ; if ( $ ipTools -> validIp ( $ query , 'ipv4' , false ) ) { if ( $ ipTools -> validIp ( $ query , 'ipv4' ) ) { return self :: QTYPE_IPV4 ; } else { return self :: QTYPE_UNKNOWN ; } } elseif ( $ ipTools -> validIp ( $ query , 'ipv6' , false ) ) { if ( $ ipTools -> validIp ( $ query , 'ipv6' ) ) { return self :: QTYPE_IPV6 ; } else { return self :: QTYPE_UNKNOWN ; } } elseif ( ! empty ( $ query ) && strpos ( $ query , '.' ) !== false ) { return self :: QTYPE_DOMAIN ; } elseif ( ! empty ( $ query ) && strpos ( $ query , '.' ) === false ) { return self :: QTYPE_AS ; } else { return self :: QTYPE_UNKNOWN ; } }
Guess query type

@param string $query

@return int Query type
Guess query type