1616use Geocoder \Exception \InvalidArgument ;
1717use Geocoder \Exception \InvalidServerResponse ;
1818use Geocoder \Exception \UnsupportedOperation ;
19- use Geocoder \Model \AddressCollection ;
20- use Geocoder \Model \AddressBuilder ;
21- use Geocoder \Query \GeocodeQuery ;
22- use Geocoder \Query \ReverseQuery ;
2319use Geocoder \Http \Provider \AbstractHttpProvider ;
20+ use Geocoder \Model \AddressBuilder ;
21+ use Geocoder \Model \AddressCollection ;
2422use Geocoder \Provider \Mapbox \Model \MapboxAddress ;
2523use Geocoder \Provider \Provider ;
24+ use Geocoder \Query \GeocodeQuery ;
25+ use Geocoder \Query \ReverseQuery ;
2626use Psr \Http \Client \ClientInterface ;
2727
2828final class Mapbox extends AbstractHttpProvider implements Provider
2929{
3030 /**
3131 * @var string
3232 */
33- const GEOCODE_ENDPOINT_URL_SSL = 'https://api.mapbox.com/geocoding/v5/%s/%s.json ' ;
33+ public const GEOCODE_ENDPOINT_URL_SSL = 'https://api.mapbox.com/geocoding/v5/%s/%s.json ' ;
3434
3535 /**
3636 * @var string
3737 */
38- const REVERSE_ENDPOINT_URL_SSL = 'https://api.mapbox.com/geocoding/v5/%s/%F,%F.json ' ;
38+ public const REVERSE_ENDPOINT_URL_SSL = 'https://api.mapbox.com/geocoding/v5/%s/%F,%F.json ' ;
3939
4040 /**
4141 * @var string
4242 */
43- const GEOCODING_MODE_PLACES = 'mapbox.places ' ;
43+ public const GEOCODING_MODE_PLACES = 'mapbox.places ' ;
4444
4545 /**
4646 * @var string
4747 */
48- const GEOCODING_MODE_PLACES_PERMANENT = 'mapbox.places-permanent ' ;
48+ public const GEOCODING_MODE_PLACES_PERMANENT = 'mapbox.places-permanent ' ;
4949
5050 /**
5151 * @var array
5252 */
53- const GEOCODING_MODES = [
53+ public const GEOCODING_MODES = [
5454 self ::GEOCODING_MODE_PLACES ,
5555 self ::GEOCODING_MODE_PLACES_PERMANENT ,
5656 ];
5757
5858 /**
5959 * @var string
6060 */
61- const TYPE_COUNTRY = 'country ' ;
61+ public const TYPE_COUNTRY = 'country ' ;
6262
6363 /**
6464 * @var string
6565 */
66- const TYPE_REGION = 'region ' ;
66+ public const TYPE_REGION = 'region ' ;
6767
6868 /**
6969 * @var string
7070 */
71- const TYPE_POSTCODE = 'postcode ' ;
71+ public const TYPE_POSTCODE = 'postcode ' ;
7272
7373 /**
7474 * @var string
7575 */
76- const TYPE_DISTRICT = 'district ' ;
76+ public const TYPE_DISTRICT = 'district ' ;
7777
7878 /**
7979 * @var string
8080 */
81- const TYPE_PLACE = 'place ' ;
81+ public const TYPE_PLACE = 'place ' ;
8282
8383 /**
8484 * @var string
8585 */
86- const TYPE_LOCALITY = 'locality ' ;
86+ public const TYPE_LOCALITY = 'locality ' ;
8787
8888 /**
8989 * @var string
9090 */
91- const TYPE_NEIGHBORHOOD = 'neighborhood ' ;
91+ public const TYPE_NEIGHBORHOOD = 'neighborhood ' ;
9292
9393 /**
9494 * @var string
9595 */
96- const TYPE_ADDRESS = 'address ' ;
96+ public const TYPE_ADDRESS = 'address ' ;
9797
9898 /**
9999 * @var string
100100 */
101- const TYPE_POI = 'poi ' ;
101+ public const TYPE_POI = 'poi ' ;
102102
103103 /**
104104 * @var string
105105 */
106- const TYPE_POI_LANDMARK = 'poi.landmark ' ;
106+ public const TYPE_POI_LANDMARK = 'poi.landmark ' ;
107107
108108 /**
109109 * @var array
110110 */
111- const TYPES = [
111+ public const TYPES = [
112112 self ::TYPE_COUNTRY ,
113113 self ::TYPE_REGION ,
114114 self ::TYPE_POSTCODE ,
@@ -121,7 +121,7 @@ final class Mapbox extends AbstractHttpProvider implements Provider
121121 self ::TYPE_POI_LANDMARK ,
122122 ];
123123
124- const DEFAULT_TYPE = self ::TYPE_ADDRESS ;
124+ public const DEFAULT_TYPE = self ::TYPE_ADDRESS ;
125125
126126 /**
127127 * @var string
@@ -139,10 +139,8 @@ final class Mapbox extends AbstractHttpProvider implements Provider
139139 private $ geocodingMode ;
140140
141141 /**
142- * @param ClientInterface $client An HTTP adapter
143- * @param string $accessToken Your Mapbox access token
144- * @param string|null $country
145- * @param string $geocodingMode
142+ * @param ClientInterface $client An HTTP adapter
143+ * @param string $accessToken Your Mapbox access token
146144 */
147145 public function __construct (
148146 ClientInterface $ client ,
@@ -223,20 +221,12 @@ public function reverseQuery(ReverseQuery $query): Collection
223221 return $ this ->fetchUrl ($ url , $ query ->getLimit (), $ query ->getLocale (), $ query ->getData ('country ' , $ this ->country ));
224222 }
225223
226- /**
227- * {@inheritdoc}
228- */
229224 public function getName (): string
230225 {
231226 return 'mapbox ' ;
232227 }
233228
234229 /**
235- * @param string $url
236- * @param int $limit
237- * @param string|null $locale
238- * @param string|null $country
239- *
240230 * @return string query with extra params
241231 */
242232 private function buildQuery (string $ url , int $ limit , string $ locale = null , string $ country = null ): string
@@ -253,14 +243,6 @@ private function buildQuery(string $url, int $limit, string $locale = null, stri
253243 return $ url .$ separator .http_build_query ($ parameters );
254244 }
255245
256- /**
257- * @param string $url
258- * @param int $limit
259- * @param string|null $locale
260- * @param string|null $country
261- *
262- * @return AddressCollection
263- */
264246 private function fetchUrl (string $ url , int $ limit , string $ locale = null , string $ country = null ): AddressCollection
265247 {
266248 $ url = $ this ->buildQuery ($ url , $ limit , $ locale , $ country );
@@ -323,9 +305,8 @@ private function fetchUrl(string $url, int $limit, string $locale = null, string
323305 /**
324306 * Update current resultSet with given key/value.
325307 *
326- * @param AddressBuilder $builder
327- * @param string $type Component type
328- * @param array $value The component value
308+ * @param string $type Component type
309+ * @param array $value The component value
329310 */
330311 private function updateAddressComponent (AddressBuilder $ builder , string $ type , array $ value )
331312 {
@@ -378,10 +359,7 @@ private function updateAddressComponent(AddressBuilder $builder, string $type, a
378359 /**
379360 * Decode the response content and validate it to make sure it does not have any errors.
380361 *
381- * @param string $url
382362 * @param string $content
383- *
384- * @return array
385363 */
386364 private function validateResponse (string $ url , $ content ): array
387365 {
@@ -397,9 +375,6 @@ private function validateResponse(string $url, $content): array
397375
398376 /**
399377 * Parse coordinats and bounds.
400- *
401- * @param AddressBuilder $builder
402- * @param array $result
403378 */
404379 private function parseCoordinates (AddressBuilder $ builder , array $ result )
405380 {
0 commit comments