| @@ -127,11 +127,7 @@ | ||
| 127 | 127 | * Get coordinates latitude/longitude | 
| 128 | 128 | * | 
| 129 | 129 | * @return array The latitude/longitude coordinates | 
| 130 | - * @param string $street[optional] | |
| 131 | 130 | * @param string $streetNumber[optional] | 
| 132 | - * @param string $city[optional] | |
| 133 | - * @param string $zip[optional] | |
| 134 | - * @param string $country[optional] | |
| 135 | 131 | */ | 
| 136 | 132 | public function getCoordinates( | 
| 137 | 133 | $street = null, | 
| @@ -29,10 +29,10 @@ discard block | ||
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | 31 | // define url | 
| 32 | - $url = self::API_URL . '?'; | |
| 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) $url .= $key.'='.urlencode($value).'&'; | |
| 36 | 36 | |
| 37 | 37 | // trim last & | 
| 38 | 38 | $url = trim($url, '&'); | 
| @@ -94,7 +94,7 @@ discard block | ||
| 94 | 94 | |
| 95 | 95 | // define result | 
| 96 | 96 | $addressSuggestions = $this->doCall(array( | 
| 97 | - 'latlng' => $latitude . ',' . $longitude, | |
| 97 | + 'latlng' => $latitude.','.$longitude, | |
| 98 | 98 | 'sensor' => 'false' | 
| 99 | 99 | )); | 
| 100 | 100 | |
| @@ -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); | 
| @@ -8,7 +8,7 @@ discard block | ||
| 8 | 8 | * @author Jeroen Desloovere <[email protected]> | 
| 9 | 9 | */ | 
| 10 | 10 | |
| 11 | -require_once __DIR__ . '/../src/Geolocation.php'; | |
| 11 | +require_once __DIR__.'/../src/Geolocation.php'; | |
| 12 | 12 | |
| 13 | 13 | use JeroenDesloovere\Geolocation\Geolocation; | 
| 14 | 14 | |
| @@ -16,10 +16,10 @@ discard block | ||
| 16 | 16 |  $result = Geolocation::getCoordinates('Koningin Maria Hendrikaplein', '1', 'Gent', '9000', 'belgië'); | 
| 17 | 17 | |
| 18 | 18 | // dump result | 
| 19 | -echo 'Coordinates = ' . $result['latitude'] . ', ' . $result['longitude'] . '<br/>'; | |
| 19 | +echo 'Coordinates = '.$result['latitude'].', '.$result['longitude'].'<br/>'; | |
| 20 | 20 | |
| 21 | 21 | // define result: @return array(label, street, streetNumber, city, cityLocal, zip, country, countryLabel) | 
| 22 | 22 | $result = Geolocation::getAddress(51.0363935, 3.7121008); | 
| 23 | 23 | |
| 24 | 24 | // define result | 
| 25 | -echo 'Address = ' . $result['label'] . '<br/>'; | |
| 25 | +echo 'Address = '.$result['label'].'<br/>'; | |
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | namespace JeroenDesloovere\Geolocation\tests; | 
| 4 | 4 | |
| 5 | 5 | // required to load | 
| 6 | -require_once __DIR__ . '/../vendor/autoload.php'; | |
| 6 | +require_once __DIR__.'/../vendor/autoload.php'; | |
| 7 | 7 | |
| 8 | 8 | /* | 
| 9 | 9 | * This file is part of the Geolocation PHP Class from Jeroen Desloovere. |