public function lookup($sIp = '')
    {
        $sIp = trim($sIp);

        if (empty($sIp) && !empty($_SERVER['REMOTE_ADDR'])) {
            $sIp = $_SERVER['REMOTE_ADDR'];
        }

        $oCache = $this->getCache($sIp);

        if (!empty($oCache)) {
            return $oCache;
        }

        $oIp = $this->oDriver->lookup($sIp);

        if (!($oIp instanceof Ip)) {
            throw new GeoIpException('Geo IP Driver did not return a \Nails\GeoIp\Result\Ip result');
        }

        $this->setCache($sIp, $oIp);

        return $oIp;
    }
public function lookup($sIp = '')
    {
        $sIp = trim($sIp);

        if (empty($sIp) && !empty($_SERVER['REMOTE_ADDR'])) {
            $sIp = $_SERVER['REMOTE_ADDR'];
        }

        $oCache = $this->getCache($sIp);

        if (!empty($oCache)) {
            return $oCache;
        }

        $oIp = $this->oDriver->lookup($sIp);

        if (!($oIp instanceof Ip)) {
            throw new GeoIpException('Geo IP Driver did not return a \Nails\GeoIp\Result\Ip result');
        }

        $this->setCache($sIp, $oIp);

        return $oIp;
    }
public function lookup ( $ sIp = '' ) { $ sIp = trim ( $ sIp ) ; if ( empty ( $ sIp ) && ! empty ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) { $ sIp = $ _SERVER [ 'REMOTE_ADDR' ] ; } $ oCache = $ this -> getCache ( $ sIp ) ; if ( ! empty ( $ oCache ) ) { return $ oCache ; } $ oIp = $ this -> oDriver -> lookup ( $ sIp ) ; if ( ! ( $ oIp instanceof Ip ) ) { throw new GeoIpException ( 'Geo IP Driver did not return a \Nails\GeoIp\Result\Ip result' ) ; } $ this -> setCache ( $ sIp , $ oIp ) ; return $ oIp ; }
Return all information about a given IP

@param string $sIp The IP to get details for

@throws GeoIpException
@return \Nails\GeoIp\Result\Ip
Return all information about a given IP