Example #1
0
 public function registerUser($firstName, $lastName, $email, $password, $dateOfBirth, $stateLimitation = null, $startRegion = null, Zend_Service_SecondLife_Coordinate $startCoordinate = null, Zend_Service_SecondLife_Coordinate_Look $lookCoordinate = null)
 {
     $params = array('username' => $firstName, 'last_name_id' => is_int($lastName) ? $lastName : $this->getLastNameId($lastName), 'email' => $email, 'password' => $password, 'dob' => $dateOfBirth);
     if (null !== $stateLimitation) {
         if (!is_integer($stateLimitation)) {
             require_once 'Zend/Service/SecondLife/Exception.php';
             throw new Zend_Service_SecondLife_Exception(sprintf('Parameter $stateLimitation must be an integer. "%s" given', gettype($stateLimitation)));
         }
         $params['limited_to_estate'] = $stateLimitation;
     }
     if (null !== $startRegion) {
         $params['start_region_name'] = $startRegion;
         if (null !== $startCoordinate) {
             $params['start_local_x'] = $startCoordinate->getX();
             $params['start_local_y'] = $startCoordinate->getY();
             $params['start_local_z'] = $startCoordinate->getZ();
         }
         if (null !== $lookCoordinate) {
             $params['start_look_at_x'] = $lookCoordinate->getX();
             $params['start_look_at_y'] = $lookCoordinate->getY();
             $params['start_look_at_z'] = $lookCoordinate->getZ();
         }
     }
     require_once 'Zend/Service/SecondLife/Value/Llsd.php';
     $request = new Zend_Service_SecondLife_Value_Llsd($params);
     $xml = $this->_httpPost($this->getCapability('create_user'), $request->toXml());
     $result = $this->_parseResponse($xml);
     if (isset($result['agent_id'])) {
         return $result['agent_id'];
     } else {
         $errorCode = array_shift($result);
         require_once 'Zend/Service/SecondLife/Exception.php';
         throw new Zend_Service_SecondLife_Exception($this->getErrorDescription($errorCode), $errorCode);
     }
 }
 public function testSettingCoordinate()
 {
     $coord = new Zend_Service_SecondLife_Coordinate($this->x, $this->y, $this->z);
     $this->assertEquals($this->x, $coord->getX());
     $this->assertEquals($this->y, $coord->getY());
     $this->assertEquals($this->z, $coord->getZ());
 }