limit() public method

Sets the maximum number of Address objects that can be returned by geocode() or reverse() methods.
public limit ( integer $limit ) : Geocoder
$limit integer
return Geocoder
 public function compare(\Geocoder\Geocoder $geocoder)
 {
     $data = new \stdClass();
     try {
         $time_pre = microtime(true);
         $address = $geocoder->limit(1)->geocode($this->query)->first();
         $time_post = microtime(true);
         $formatter = new \Geocoder\Formatter\StringFormatter();
         $data->address = $formatter->format($address, "%S %n, %z %L");
         $data->latitude = $address->getLatitude();
         $data->longitude = $address->getLongitude();
         $data->microtime = $time_post - $time_pre;
     } catch (\Exception $e) {
         $data = $e->getMessage();
     }
     $this->table[$geocoder->getName()] = $data;
     return $this;
 }
Beispiel #2
0
 /**
  * 
  *
  * @param integer $maxResults
  * @return \Geocoder\GeocoderInterface 
  * @static 
  */
 public static function limit($maxResults)
 {
     return \Geocoder\Geocoder::limit($maxResults);
 }