Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to willdurand/geocoder version 3.2 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 02-features/traits/Geocodable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -25,7 +25,7 @@ public function getLatitude()
$this->geocodeAddress();
}

return $this->geocoderResult->getLatitude();
return $this->geocoderResult->first()->getLatitude();
}

public function getLongitude()
Expand All @@ -34,7 +34,7 @@ public function getLongitude()
$this->geocodeAddress();
}

return $this->geocoderResult->getLongitude();
return $this->geocoderResult->first()->getLongitude();
}

protected function geocodeAddress()
Expand Down
2 changes: 1 addition & 1 deletion 02-features/traits/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"willdurand/geocoder": "~2.8"
"willdurand/geocoder": "^3.2"
}
}
6 changes: 3 additions & 3 deletions 02-features/traits/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down