Skip to content

Commit beeb832

Browse files
Run CodeSniffer
vendor/bin/phpcbf --standard=psr2 --extensions=php --warning-severity=0 --report=full "src"
1 parent 4c730d0 commit beeb832

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

src/Geolocation.php

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ protected function doCall($parameters = array())
4848
$url = ($this->https ? 'https://' : 'http://') . self::API_URL . '?';
4949

5050
// add every parameter to the url
51-
foreach ($parameters as $key => $value) $url .= $key . '=' . urlencode($value) . '&';
51+
foreach ($parameters as $key => $value) {
52+
$url .= $key . '=' . urlencode($value) . '&';
53+
}
5254

5355
// trim last &
5456
$url = trim($url, '&');
@@ -64,7 +66,9 @@ protected function doCall($parameters = array())
6466
curl_setopt($curl, CURLOPT_URL, $url);
6567
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
6668
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
67-
if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
69+
if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
70+
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
71+
}
6872

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

7983
// we have errors
80-
if ($errorNumber != '') throw new Exception($errorMessage);
84+
if ($errorNumber != '') {
85+
throw new Exception($errorMessage);
86+
}
8187

8288
// redefine response as json decoded
8389
$response = json_decode($response);
@@ -159,19 +165,29 @@ public function getCoordinates(
159165
$item = array();
160166

161167
// add street
162-
if (!empty($street)) $item[] = $street;
168+
if (!empty($street)) {
169+
$item[] = $street;
170+
}
163171

164172
// add street number
165-
if (!empty($streetNumber)) $item[] = $streetNumber;
173+
if (!empty($streetNumber)) {
174+
$item[] = $streetNumber;
175+
}
166176

167177
// add city
168-
if (!empty($city)) $item[] = $city;
178+
if (!empty($city)) {
179+
$item[] = $city;
180+
}
169181

170182
// add zip
171-
if (!empty($zip)) $item[] = $zip;
183+
if (!empty($zip)) {
184+
$item[] = $zip;
185+
}
172186

173187
// add country
174-
if (!empty($country)) $item[] = $country;
188+
if (!empty($country)) {
189+
$item[] = $country;
190+
}
175191

176192
// define value
177193
$address = implode(' ', $item);

0 commit comments

Comments
 (0)