| @@ -45,7 +45,9 @@ discard block | ||
| 45 | 45 | $url = ($this->https ? 'https://' : 'http://') . self::API_URL . '?'; | 
| 46 | 46 | |
| 47 | 47 | // add every parameter to the url | 
| 48 | - foreach ($parameters as $key => $value) $url .= $key . '=' . urlencode($value) . '&'; | |
| 48 | +        foreach ($parameters as $key => $value) { | |
| 49 | + $url .= $key . '=' . urlencode($value) . '&'; | |
| 50 | + } | |
| 49 | 51 | |
| 50 | 52 | // trim last & | 
| 51 | 53 | $url = trim($url, '&'); | 
| @@ -61,7 +63,9 @@ discard block | ||
| 61 | 63 | curl_setopt($curl, CURLOPT_URL, $url); | 
| 62 | 64 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | 
| 63 | 65 | curl_setopt($curl, CURLOPT_TIMEOUT, 10); | 
| 64 | -        if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | |
| 66 | +        if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) { | |
| 67 | + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | |
| 68 | + } | |
| 65 | 69 | |
| 66 | 70 | // execute | 
| 67 | 71 | $response = curl_exec($curl); | 
| @@ -74,13 +78,17 @@ discard block | ||
| 74 | 78 | curl_close($curl); | 
| 75 | 79 | |
| 76 | 80 | // we have errors | 
| 77 | - if ($errorNumber != '') throw new GeolocationException($errorMessage); | |
| 81 | +        if ($errorNumber != '') { | |
| 82 | + throw new GeolocationException($errorMessage); | |
| 83 | + } | |
| 78 | 84 | |
| 79 | 85 | // redefine response as json decoded | 
| 80 | 86 | $response = json_decode($response); | 
| 81 | 87 | |
| 82 | 88 | // API returns with an error | 
| 83 | - if (isset($response->error_message)) throw new GeolocationException($response->error_message); | |
| 89 | +        if (isset($response->error_message)) { | |
| 90 | + throw new GeolocationException($response->error_message); | |
| 91 | + } | |
| 84 | 92 | |
| 85 | 93 | // return the content | 
| 86 | 94 | return $response->results; | 
| @@ -164,19 +172,29 @@ discard block | ||
| 164 | 172 | $item = array(); | 
| 165 | 173 | |
| 166 | 174 | // add street | 
| 167 | - if (!empty($street)) $item[] = $street; | |
| 175 | +        if (!empty($street)) { | |
| 176 | + $item[] = $street; | |
| 177 | + } | |
| 168 | 178 | |
| 169 | 179 | // add street number | 
| 170 | - if (!empty($streetNumber)) $item[] = $streetNumber; | |
| 180 | +        if (!empty($streetNumber)) { | |
| 181 | + $item[] = $streetNumber; | |
| 182 | + } | |
| 171 | 183 | |
| 172 | 184 | // add city | 
| 173 | - if (!empty($city)) $item[] = $city; | |
| 185 | +        if (!empty($city)) { | |
| 186 | + $item[] = $city; | |
| 187 | + } | |
| 174 | 188 | |
| 175 | 189 | // add zip | 
| 176 | - if (!empty($zip)) $item[] = $zip; | |
| 190 | +        if (!empty($zip)) { | |
| 191 | + $item[] = $zip; | |
| 192 | + } | |
| 177 | 193 | |
| 178 | 194 | // add country | 
| 179 | - if (!empty($country)) $item[] = $country; | |
| 195 | +        if (!empty($country)) { | |
| 196 | + $item[] = $country; | |
| 197 | + } | |
| 180 | 198 | |
| 181 | 199 | // define value | 
| 182 | 200 |          $address = implode(' ', $item); |