コード例 #1
0
 public function testCreateGeoPoint()
 {
     $LATITUDE = 40.733497;
     $LONGITUDE = -74.058645;
     $geo_point = new Domain\GeoPoint($LATITUDE, $LONGITUDE);
     $this->assertEquals($geo_point->getLatitude(), $LATITUDE);
     $this->assertEquals($geo_point->getLongitude(), $LONGITUDE);
 }
コード例 #2
0
ファイル: Maps.php プロジェクト: emigm/media-inspector
 public function getReverseGeoCode(Domain\GeoPoint $geo_point)
 {
     $uri = self::GEOCODE_URI;
     $lat_lng = $geo_point->getLatitude() . ',' . $geo_point->getLongitude();
     $query = ['latlng' => $lat_lng, 'key' => $this->api_key];
     $response = $this->rest_client->get($uri, $query);
     switch ($response->getStatusCode()) {
         case 200:
             return $this->responseToReverseGeoCode($response);
             break;
         case 400:
             $this->responseToClientException($response);
             break;
         case 500:
             $this->responseToServerException($response);
             break;
         default:
             $this->responseToServerException($response);
             break;
     }
     return $reverse_geo_code;
 }