Ejemplo n.º 1
0
 /**
  * sets spatial and the given radius for a circle search
  *
  * @param integer $radius
  * @return Zend_Service_DeveloperGarden_LocalSearch_SearchParameters
  */
 public function setRadius($radius)
 {
     $validator = new Zend\Validator\Int();
     if (!$validator->isValid($radius)) {
         $message = $validator->getMessages();
         throw new Zend_Service_DeveloperGarden_LocalSearch_Exception(current($message));
     }
     $this->_parameters['radius'] = $radius;
     $this->_parameters['transformgeocode'] = 'false';
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Validate Group Search Options
  *
  * @param  array $options
  * @throws Zend\Service\Exception
  * @return void
  */
 protected function _validateGroupPoolGetPhotos(array $options)
 {
     $validOptions = array('api_key', 'tags', 'method', 'group_id', 'per_page', 'page', 'extras', 'user_id');
     $this->_compareOptions($options, $validOptions);
     $between = new Zend\Validator\Between(1, 500, true);
     if (!$between->isValid($options['per_page'])) {
         throw new Zend\Service\Exception($options['per_page'] . ' is not valid for the "per_page" option');
     }
     $int = new Zend\Validator\Int();
     if (!$int->isValid($options['page'])) {
         throw new Zend\Service\Exception($options['page'] . ' is not valid for the "page" option');
     }
     // validate extras, which are delivered in csv format
     if (isset($options['extras'])) {
         $extras = explode(',', $options['extras']);
         $validExtras = array('license', 'date_upload', 'date_taken', 'owner_name', 'icon_server');
         foreach ($extras as $extra) {
             /**
              * @todo The following does not do anything [yet], so it is commented out.
              */
             //in_array(trim($extra), $validExtras);
         }
     }
 }