コード例 #1
0
 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;
 }