Skip to content

Commit

Permalink
Added request optional parameter functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarsstrods committed Dec 23, 2017
1 parent 9617455 commit 546e3a6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Geocoder.php
Expand Up @@ -6,9 +6,18 @@

class Geocoder extends AbstractGeocoder
{
public function geocode($query)
public function geocode($query, $optParams = [])
{
$url = self::URL . 'q=' . urlencode($query);

if(is_array($optParams) && !empty($optParams))
{
foreach($optParams as $param => $paramValue)
{
$url .= '&'.$param.'=' . urlencode($paramValue);
}
}

if (empty($this->key)) {
throw new \Exception('Missing API key');
}
Expand Down

0 comments on commit 546e3a6

Please sign in to comment.