public function get($ipAddress)
    {
        if (\func_num_args() !== 1) {
            throw new \InvalidArgumentException(
                'Method takes exactly one argument.'
            );
        }

        if (!\is_resource($this->fileHandle)) {
            throw new \BadMethodCallException(
                'Attempt to read from a closed MaxMind DB.'
            );
        }

        if (!filter_var($ipAddress, FILTER_VALIDATE_IP)) {
            throw new \InvalidArgumentException(
                "The value \"$ipAddress\" is not a valid IP address."
            );
        }

        if ($this->metadata->ipVersion === 4 && strrpos($ipAddress, ':')) {
            throw new \InvalidArgumentException(
                "Error looking up $ipAddress. You attempted to look up an"
                . ' IPv6 address in an IPv4-only database.'
            );
        }
        $pointer = $this->findAddressInTree($ipAddress);
        if ($pointer === 0) {
            return null;
        }

        return $this->resolveDataPointer($pointer);
    }
public function get($ipAddress)
    {
        if (\func_num_args() !== 1) {
            throw new \InvalidArgumentException(
                'Method takes exactly one argument.'
            );
        }

        if (!\is_resource($this->fileHandle)) {
            throw new \BadMethodCallException(
                'Attempt to read from a closed MaxMind DB.'
            );
        }

        if (!filter_var($ipAddress, FILTER_VALIDATE_IP)) {
            throw new \InvalidArgumentException(
                "The value \"$ipAddress\" is not a valid IP address."
            );
        }

        if ($this->metadata->ipVersion === 4 && strrpos($ipAddress, ':')) {
            throw new \InvalidArgumentException(
                "Error looking up $ipAddress. You attempted to look up an"
                . ' IPv6 address in an IPv4-only database.'
            );
        }
        $pointer = $this->findAddressInTree($ipAddress);
        if ($pointer === 0) {
            return null;
        }

        return $this->resolveDataPointer($pointer);
    }
public function get ( $ ipAddress ) { if ( \ func_num_args ( ) !== 1 ) { throw new \ InvalidArgumentException ( 'Method takes exactly one argument.' ) ; } if ( ! \ is_resource ( $ this -> fileHandle ) ) { throw new \ BadMethodCallException ( 'Attempt to read from a closed MaxMind DB.' ) ; } if ( ! filter_var ( $ ipAddress , FILTER_VALIDATE_IP ) ) { throw new \ InvalidArgumentException ( "The value \"$ipAddress\" is not a valid IP address." ) ; } if ( $ this -> metadata -> ipVersion === 4 && strrpos ( $ ipAddress , ':' ) ) { throw new \ InvalidArgumentException ( "Error looking up $ipAddress. You attempted to look up an" . ' IPv6 address in an IPv4-only database.' ) ; } $ pointer = $ this -> findAddressInTree ( $ ipAddress ) ; if ( $ pointer === 0 ) { return null ; } return $ this -> resolveDataPointer ( $ pointer ) ; }
Looks up the address in the MaxMind DB.

@param string $ipAddress
the IP address to look up

@throws \BadMethodCallException   if this method is called on a closed database
@throws \InvalidArgumentException if something other than a single IP address is passed to the method
@throws InvalidDatabaseException
if the database is invalid or there is an error reading
from it

@return array the record for the IP address
Looks up the address in the MaxMind DB .