Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SachinAgarwal1337 committed Jul 20, 2016
2 parents a119ce9 + ed49502 commit d303b44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"autoload": {
"files": [
"helpers/functions.php"
"src/helpers.php"
],

"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions src/PlacesApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ private function prepareNearbySearchParams($location, $radius, $params)
) {
unset($params['radius']);

if (!array_any_keys_exists(['keyword', 'name', 'types'], $params)) {
if (!array_any_keys_exists(['keyword', 'name', 'type'], $params)) {
throw new GooglePlacesApiException("Nearby Search require one"
. " or more of 'keyword', 'name', or 'types' params since 'rankby' = 'distance'.");
. " or more of 'keyword', 'name', or 'type' params since 'rankby' = 'distance'.");
}
} elseif (!$radius) {
throw new GooglePlacesApiException("'radius' param is not defined.");
Expand All @@ -302,7 +302,7 @@ private function prepareRadarSearchParams($location, $radius, $params)

if (!array_any_keys_exists(['keyword', 'name', 'type'], $params)) {
throw new GooglePlacesApiException("Radar Search require one"
. " or more of 'keyword', 'name', or 'types' params.");
. " or more of 'keyword', 'name', or 'type' params.");
}

return $params;
Expand Down
8 changes: 3 additions & 5 deletions helpers/functions.php → src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
*/
function array_any_keys_exists(array $keys, array $array)
{
$result = false;

foreach ($keys as $key) {
$result = $result OR array_key_exists($key, $array);
if (array_key_exists($key, $array)) {
return true;
}
}

return $result;
}
}

0 comments on commit d303b44

Please sign in to comment.