Skip to content

Commit

Permalink
Run CodeSniffer
Browse files Browse the repository at this point in the history
vendor/bin/phpcbf --standard=psr2 --extensions=php --warning-severity=0
--report=full "src"
  • Loading branch information
jeroendesloovere committed Mar 29, 2018
1 parent 4c730d0 commit beeb832
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/Geolocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ protected function doCall($parameters = array())
$url = ($this->https ? 'https://' : 'http://') . self::API_URL . '?';

// add every parameter to the url
foreach ($parameters as $key => $value) $url .= $key . '=' . urlencode($value) . '&';
foreach ($parameters as $key => $value) {
$url .= $key . '=' . urlencode($value) . '&';
}

// trim last &
$url = trim($url, '&');
Expand All @@ -64,7 +66,9 @@ protected function doCall($parameters = array())
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
}

// execute
$response = curl_exec($curl);
Expand All @@ -77,7 +81,9 @@ protected function doCall($parameters = array())
curl_close($curl);

// we have errors
if ($errorNumber != '') throw new Exception($errorMessage);
if ($errorNumber != '') {
throw new Exception($errorMessage);
}

// redefine response as json decoded
$response = json_decode($response);
Expand Down Expand Up @@ -159,19 +165,29 @@ public function getCoordinates(
$item = array();

// add street
if (!empty($street)) $item[] = $street;
if (!empty($street)) {
$item[] = $street;
}

// add street number
if (!empty($streetNumber)) $item[] = $streetNumber;
if (!empty($streetNumber)) {
$item[] = $streetNumber;
}

// add city
if (!empty($city)) $item[] = $city;
if (!empty($city)) {
$item[] = $city;
}

// add zip
if (!empty($zip)) $item[] = $zip;
if (!empty($zip)) {
$item[] = $zip;
}

// add country
if (!empty($country)) $item[] = $country;
if (!empty($country)) {
$item[] = $country;
}

// define value
$address = implode(' ', $item);
Expand Down

0 comments on commit beeb832

Please sign in to comment.