From dedb190c4aae10dd7446d4e9368d3d305a4244e1 Mon Sep 17 00:00:00 2001 From: Jaime Chavarriaga Date: Wed, 28 Oct 2015 13:10:37 +0000 Subject: [PATCH] Update to willdurand/geocoder version 3.2 --- 02-features/traits/Geocodable.php | 6 +++--- 02-features/traits/composer.json | 2 +- 02-features/traits/index.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/02-features/traits/Geocodable.php b/02-features/traits/Geocodable.php index 2631d91..a5d47b6 100644 --- a/02-features/traits/Geocodable.php +++ b/02-features/traits/Geocodable.php @@ -9,7 +9,7 @@ trait Geocodable { /** @var \Geocoder\Result\Geocoded */ protected $geocoderResult; - public function setGeocoder(\Geocoder\GeocoderInterface $geocoder) + public function setGeocoder(\Geocoder\Geocoder $geocoder) { $this->geocoder = $geocoder; } @@ -25,7 +25,7 @@ public function getLatitude() $this->geocodeAddress(); } - return $this->geocoderResult->getLatitude(); + return $this->geocoderResult->first()->getLatitude(); } public function getLongitude() @@ -34,7 +34,7 @@ public function getLongitude() $this->geocodeAddress(); } - return $this->geocoderResult->getLongitude(); + return $this->geocoderResult->first()->getLongitude(); } protected function geocodeAddress() diff --git a/02-features/traits/composer.json b/02-features/traits/composer.json index aafb117..6d90e3b 100644 --- a/02-features/traits/composer.json +++ b/02-features/traits/composer.json @@ -1,5 +1,5 @@ { "require": { - "willdurand/geocoder": "~2.8" + "willdurand/geocoder": "^3.2" } } diff --git a/02-features/traits/index.php b/02-features/traits/index.php index 6ee72f6..1c8186a 100644 --- a/02-features/traits/index.php +++ b/02-features/traits/index.php @@ -3,9 +3,9 @@ require 'Geocodable.php'; require 'RetailStore.php'; -$geocoderAdapter = new \Geocoder\HttpAdapter\CurlHttpAdapter(); -$geocoderProvider = new \Geocoder\Provider\GoogleMapsProvider($geocoderAdapter); -$geocoder = new \Geocoder\Geocoder($geocoderProvider); +$geocoderAdapter = new \Ivory\HttpAdapter\CurlHttpAdapter(); +$geocoder = new \Geocoder\ProviderAggregator(); +$geocoder->registerProvider(new \Geocoder\Provider\GoogleMaps($geocoderAdapter)); $store = new RetailStore(); $store->setAddress('420 9th Avenue, New York, NY 10001 USA');