From 90814cb71855a312925c125d49238f38a5a60c2f Mon Sep 17 00:00:00 2001 From: Rasmus Bengtsson Date: Tue, 28 Jan 2014 17:04:00 +0100 Subject: [PATCH] Added support for radarsearch and place details --- GooglePlaces.php | 36 ++++++++++++++++++++++++++++++++++++ README.md | 16 ++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/GooglePlaces.php b/GooglePlaces.php index 45f9ad2..cfffd8a 100644 --- a/GooglePlaces.php +++ b/GooglePlaces.php @@ -17,6 +17,8 @@ class GooglePlaces public $rankby = 'prominence'; public $sensor = false; public $types = null; + public $reference = null; + public $opennow = null; public function __construct($key) { @@ -139,6 +141,40 @@ class GooglePlaces } } + break; + + case 'radarsearch': + if (!isset($parameters['location'])) + { + throw new Exception('You must specify a location before calling nearbysearch().'); + } + elseif (!isset($parameters['radius'])) + { + throw new Exception('You must specify a radius.'); + } + elseif (empty($parameters['keyword']) && empty($parameters['name']) && empty($parameters['types'])) + { + throw new Exception('A Radar Search request must include at least one of keyword, name, or types.'); + } + + if (isset($parameters['rankby'])) + { + unset($parameters['rankby']); + } + + break; + + case 'details': + if (!isset($parameters['reference'])) + { + throw new Exception('You must specify a reference before calling details().'); + } + + if (isset($parameters['rankby'])) + { + unset($parameters['rankby']); + } + break; } } diff --git a/README.md b/README.md index 13d1085..5e4b2ea 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,22 @@ $google_places->pageToken = $results['next_page_token']; $page2_results = $google_places->nearbySearch(); ``` +### Radar search + +```php +$google_places->location = array(-33.86820, 151.1945860); +$google_places->radius = 800; +$google_places->types = 'restaurant'; // Requires keyword, name or types +$results = $google_places->radarSearch(); +``` + +### Place details + +```php +$google_places->reference = '#reference#'; // Reference from search results +$details = $google_places->details(); +``` + The Fututre ----------- -- 2.39.5