@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | return new self( |
17 | 17 | 'No address found for coordinates. |
18 | - With latitude: "' . $latitude . '" and longitude "' . $longitude . '".' |
|
18 | + With latitude: "' . $latitude.'" and longitude "'.$longitude.'".' |
|
19 | 19 | ); |
20 | 20 | } |
21 | 21 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | return new self( |
25 | 25 | 'No coordinates found for address. |
26 | - With address: "' . implode(', ', $addressData) . '".' |
|
26 | + With address: "' . implode(', ', $addressData).'".' |
|
27 | 27 | ); |
28 | 28 | } |
29 | 29 | } |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | $url = ($this->https ? 'https://' : 'http://') . self::API_URL . '?'; |
49 | 49 | |
50 | 50 | // 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 | + } |
|
52 | 54 | |
53 | 55 | // trim last & |
54 | 56 | $url = trim($url, '&'); |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | curl_setopt($curl, CURLOPT_URL, $url); |
65 | 67 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
66 | 68 | 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 | + } |
|
68 | 72 | |
69 | 73 | // execute |
70 | 74 | $response = curl_exec($curl); |
@@ -77,7 +81,9 @@ discard block |
||
77 | 81 | curl_close($curl); |
78 | 82 | |
79 | 83 | // we have errors |
80 | - if ($errorNumber != '') throw new Exception($errorMessage); |
|
84 | + if ($errorNumber != '') { |
|
85 | + throw new Exception($errorMessage); |
|
86 | + } |
|
81 | 87 | |
82 | 88 | // redefine response as json decoded |
83 | 89 | $response = json_decode($response); |
@@ -159,19 +165,29 @@ discard block |
||
159 | 165 | $item = array(); |
160 | 166 | |
161 | 167 | // add street |
162 | - if (!empty($street)) $item[] = $street; |
|
168 | + if (!empty($street)) { |
|
169 | + $item[] = $street; |
|
170 | + } |
|
163 | 171 | |
164 | 172 | // add street number |
165 | - if (!empty($streetNumber)) $item[] = $streetNumber; |
|
173 | + if (!empty($streetNumber)) { |
|
174 | + $item[] = $streetNumber; |
|
175 | + } |
|
166 | 176 | |
167 | 177 | // add city |
168 | - if (!empty($city)) $item[] = $city; |
|
178 | + if (!empty($city)) { |
|
179 | + $item[] = $city; |
|
180 | + } |
|
169 | 181 | |
170 | 182 | // add zip |
171 | - if (!empty($zip)) $item[] = $zip; |
|
183 | + if (!empty($zip)) { |
|
184 | + $item[] = $zip; |
|
185 | + } |
|
172 | 186 | |
173 | 187 | // add country |
174 | - if (!empty($country)) $item[] = $country; |
|
188 | + if (!empty($country)) { |
|
189 | + $item[] = $country; |
|
190 | + } |
|
175 | 191 | |
176 | 192 | // define value |
177 | 193 | $address = implode(' ', $item); |