Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Service/DeveloperGarden/Request/IpLocation/LocateIPRequest.php
Go to the documentation of this file.
00001 <?php
00026 require_once 'Zend/Service/DeveloperGarden/Request/RequestAbstract.php';
00027 
00031 require_once 'Zend/Service/DeveloperGarden/IpLocation/IpAddress.php';
00032 
00041 class Zend_Service_DeveloperGarden_Request_IpLocation_LocateIPRequest
00042     extends Zend_Service_DeveloperGarden_Request_RequestAbstract
00043 {
00049     public $address = null;
00050 
00056     public $account = null;
00057 
00066     public function __construct($environment, $ip = null)
00067     {
00068         parent::__construct($environment);
00069 
00070         if ($ip !== null) {
00071             $this->setIp($ip);
00072         }
00073     }
00074 
00082     public function setIp($ip)
00083     {
00084         if ($ip instanceof Zend_Service_DeveloperGarden_IpLocation_IpAddress) {
00085             $this->address[] = array(
00086                 'ipType'    => $ip->getVersion(),
00087                 'ipAddress' => $ip->getIp(),
00088             );
00089             return $this;
00090         }
00091 
00092         if (is_array($ip)) {
00093             foreach ($ip as $ipObject) {
00094                 if (!$ipObject instanceof Zend_Service_DeveloperGarden_IpLocation_IpAddress
00095                     && !is_string($ipObject)
00096                 ) {
00097                     require_once 'Zend/Service/DeveloperGarden/Request/Exception.php';
00098                     throw new Zend_Service_DeveloperGarden_Request_Exception(
00099                         'Not a valid Ip Address object found.'
00100                     );
00101                 }
00102                 $this->setIp($ipObject);
00103             }
00104             return $this;
00105         }
00106 
00107         if (!is_string($ip)) {
00108             require_once 'Zend/Service/DeveloperGarden/Request/Exception.php';
00109             throw new Zend_Service_DeveloperGarden_Request_Exception('Not a valid Ip Address object found.');
00110         }
00111 
00112         return $this->setIp(new Zend_Service_DeveloperGarden_IpLocation_IpAddress($ip));
00113     }
00114 }
 All Data Structures Namespaces Files Functions Variables Enumerations