From 0afef392713d7914fe26763395bda320a5b98a08 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sat, 20 May 2017 10:56:29 +0200 Subject: [PATCH] Added result type to google location --- src/Provider/GoogleMaps/GoogleMaps.php | 3 +++ .../GoogleMaps/Model/GoogleAddress.php | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/Provider/GoogleMaps/GoogleMaps.php b/src/Provider/GoogleMaps/GoogleMaps.php index 85aa2a174..ae4689f64 100644 --- a/src/Provider/GoogleMaps/GoogleMaps.php +++ b/src/Provider/GoogleMaps/GoogleMaps.php @@ -249,6 +249,9 @@ private function fetchUrl($url, $locale, $limit) if (isset($result->geometry->location_type)) { $address->setLocationType($result->geometry->location_type); } + if (isset($result->types)) { + $address->setResultType($result->types); + } $results[] = $address; if (count($results) >= $limit) { diff --git a/src/Provider/GoogleMaps/Model/GoogleAddress.php b/src/Provider/GoogleMaps/Model/GoogleAddress.php index 96ccff9e9..184becbec 100644 --- a/src/Provider/GoogleMaps/Model/GoogleAddress.php +++ b/src/Provider/GoogleMaps/Model/GoogleAddress.php @@ -19,6 +19,11 @@ class GoogleAddress extends Address */ private $locationType; + /** + * @var array + */ + private $resultType = []; + /** * @param null|string $locationType * @@ -38,4 +43,24 @@ public function getLocationType() { return $this->locationType; } + + /** + * @return array + */ + public function getResultType() + { + return $this->resultType; + } + + /** + * @param array $resultType + * + * @return GoogleAddress + */ + public function setResultType(array $resultType) + { + $this->resultType = $resultType; + + return $this; + } }