setIp($ip); } } /** * sets new ip or array of ips * * @param Zend_Service_DeveloperGarden_IpLocation_IpAddress|array $ip * * @return Zend_Service_DeveloperGarden_Request_IpLocation_LocateIPRequest */ public function setIp($ip) { if ($ip instanceof Zend_Service_DeveloperGarden_IpLocation_IpAddress) { $this->address[] = array( 'ipType' => $ip->getVersion(), 'ipAddress' => $ip->getIp(), ); return $this; } if (is_array($ip)) { foreach ($ip as $ipObject) { if (!$ipObject instanceof Zend_Service_DeveloperGarden_IpLocation_IpAddress && !is_string($ipObject) ) { require_once 'Zend/Service/DeveloperGarden/Request/Exception.php'; throw new Zend_Service_DeveloperGarden_Request_Exception( 'Not a valid Ip Address object found.' ); } $this->setIp($ipObject); } return $this; } if (!is_string($ip)) { require_once 'Zend/Service/DeveloperGarden/Request/Exception.php'; throw new Zend_Service_DeveloperGarden_Request_Exception('Not a valid Ip Address object found.'); } return $this->setIp(new Zend_Service_DeveloperGarden_IpLocation_IpAddress($ip)); } }