@@ -32,7 +32,9 @@ discard block |
||
32 | 32 | $url = self::API_URL . '?'; |
33 | 33 | |
34 | 34 | // add every parameter to the url |
35 | - foreach ($parameters as $key => $value) $url .= $key . '=' . urlencode($value) . '&'; |
|
35 | + foreach ($parameters as $key => $value) { |
|
36 | + $url .= $key . '=' . urlencode($value) . '&'; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | // trim last & |
38 | 40 | $url = trim($url, '&'); |
@@ -44,7 +46,9 @@ discard block |
||
44 | 46 | curl_setopt($curl, CURLOPT_URL, $url); |
45 | 47 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
46 | 48 | curl_setopt($curl, CURLOPT_TIMEOUT, 10); |
47 | - if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); |
|
49 | + if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) { |
|
50 | + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); |
|
51 | + } |
|
48 | 52 | |
49 | 53 | // execute |
50 | 54 | $response = curl_exec($curl); |
@@ -57,7 +61,9 @@ discard block |
||
57 | 61 | curl_close($curl); |
58 | 62 | |
59 | 63 | // we have errors |
60 | - if ($errorNumber != '') throw new GeolocationException($errorMessage); |
|
64 | + if ($errorNumber != '') { |
|
65 | + throw new GeolocationException($errorMessage); |
|
66 | + } |
|
61 | 67 | |
62 | 68 | // redefine response as json decoded |
63 | 69 | $response = json_decode($response); |
@@ -144,19 +150,29 @@ discard block |
||
144 | 150 | $item = array(); |
145 | 151 | |
146 | 152 | // add street |
147 | - if (!empty($street)) $item[] = $street; |
|
153 | + if (!empty($street)) { |
|
154 | + $item[] = $street; |
|
155 | + } |
|
148 | 156 | |
149 | 157 | // add street number |
150 | - if (!empty($streetNumber)) $item[] = $streetNumber; |
|
158 | + if (!empty($streetNumber)) { |
|
159 | + $item[] = $streetNumber; |
|
160 | + } |
|
151 | 161 | |
152 | 162 | // add city |
153 | - if (!empty($city)) $item[] = $city; |
|
163 | + if (!empty($city)) { |
|
164 | + $item[] = $city; |
|
165 | + } |
|
154 | 166 | |
155 | 167 | // add zip |
156 | - if (!empty($zip)) $item[] = $zip; |
|
168 | + if (!empty($zip)) { |
|
169 | + $item[] = $zip; |
|
170 | + } |
|
157 | 171 | |
158 | 172 | // add country |
159 | - if (!empty($country)) $item[] = $country; |
|
173 | + if (!empty($country)) { |
|
174 | + $item[] = $country; |
|
175 | + } |
|
160 | 176 | |
161 | 177 | // define value |
162 | 178 | $address = implode(' ', $item); |