2222use Geocoder \Model \AddressCollection ;
2323use Geocoder \Provider \Here \Model \HereAddress ;
2424use Geocoder \Provider \Provider ;
25- use Geocoder \Query \Query ;
2625use Geocoder \Query \GeocodeQuery ;
26+ use Geocoder \Query \Query ;
2727use Geocoder \Query \ReverseQuery ;
2828use Psr \Http \Client \ClientInterface ;
2929
@@ -35,47 +35,47 @@ final class Here extends AbstractHttpProvider implements Provider
3535 /**
3636 * @var string
3737 */
38- const GEOCODE_ENDPOINT_URL_API_KEY = 'https://geocoder.ls.hereapi.com/6.2/geocode.json ' ;
38+ public const GEOCODE_ENDPOINT_URL_API_KEY = 'https://geocoder.ls.hereapi.com/6.2/geocode.json ' ;
3939
4040 /**
4141 * @var string
4242 */
43- const GEOCODE_ENDPOINT_URL_APP_CODE = 'https://geocoder.api.here.com/6.2/geocode.json ' ;
43+ public const GEOCODE_ENDPOINT_URL_APP_CODE = 'https://geocoder.api.here.com/6.2/geocode.json ' ;
4444
4545 /**
4646 * @var string
4747 */
48- const GEOCODE_CIT_ENDPOINT_API_KEY = 'https:/geocoder.sit.ls.hereapi.com/6.2/geocode.json ' ;
48+ public const GEOCODE_CIT_ENDPOINT_API_KEY = 'https:/geocoder.sit.ls.hereapi.com/6.2/geocode.json ' ;
4949
5050 /**
5151 * @var string
5252 */
53- const GEOCODE_CIT_ENDPOINT_APP_CODE = 'https://geocoder.cit.api.here.com/6.2/geocode.json ' ;
53+ public const GEOCODE_CIT_ENDPOINT_APP_CODE = 'https://geocoder.cit.api.here.com/6.2/geocode.json ' ;
5454
5555 /**
5656 * @var string
5757 */
58- const REVERSE_ENDPOINT_URL_API_KEY = 'https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json ' ;
58+ public const REVERSE_ENDPOINT_URL_API_KEY = 'https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json ' ;
5959
6060 /**
6161 * @var string
6262 */
63- const REVERSE_ENDPOINT_URL_APP_CODE = 'https://reverse.geocoder.api.here.com/6.2/reversegeocode.json ' ;
63+ public const REVERSE_ENDPOINT_URL_APP_CODE = 'https://reverse.geocoder.api.here.com/6.2/reversegeocode.json ' ;
6464
6565 /**
6666 * @var string
6767 */
68- const REVERSE_CIT_ENDPOINT_URL_API_KEY = 'https://reverse.geocoder.sit.ls.hereapi.com/6.2/reversegeocode.json ' ;
68+ public const REVERSE_CIT_ENDPOINT_URL_API_KEY = 'https://reverse.geocoder.sit.ls.hereapi.com/6.2/reversegeocode.json ' ;
6969
7070 /**
7171 * @var string
7272 */
73- const REVERSE_CIT_ENDPOINT_URL_APP_CODE = 'https://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json ' ;
73+ public const REVERSE_CIT_ENDPOINT_URL_APP_CODE = 'https://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json ' ;
7474
7575 /**
7676 * @var array
7777 */
78- const GEOCODE_ADDITIONAL_DATA_PARAMS = [
78+ public const GEOCODE_ADDITIONAL_DATA_PARAMS = [
7979 'CrossingStreets ' ,
8080 'PreserveUnitDesignators ' ,
8181 'Country2 ' ,
@@ -138,9 +138,6 @@ public static function createUsingApiKey(ClientInterface $client, string $apiKey
138138 return $ client ;
139139 }
140140
141- /**
142- * {@inheritdoc}
143- */
144141 public function geocodeQuery (GeocodeQuery $ query ): Collection
145142 {
146143 // This API doesn't handle IPs
@@ -177,9 +174,6 @@ public function geocodeQuery(GeocodeQuery $query): Collection
177174 return $ this ->executeQuery (sprintf ('%s?%s ' , $ this ->getBaseUrl ($ query ), http_build_query ($ queryParams )), $ query ->getLimit ());
178175 }
179176
180- /**
181- * {@inheritdoc}
182- */
183177 public function reverseQuery (ReverseQuery $ query ): Collection
184178 {
185179 $ coordinates = $ query ->getCoordinates ();
@@ -194,12 +188,6 @@ public function reverseQuery(ReverseQuery $query): Collection
194188 return $ this ->executeQuery (sprintf ('%s?%s ' , $ this ->getBaseUrl ($ query ), http_build_query ($ queryParams )), $ query ->getLimit ());
195189 }
196190
197- /**
198- * @param string $url
199- * @param int $limit
200- *
201- * @return Collection
202- */
203191 private function executeQuery (string $ url , int $ limit ): Collection
204192 {
205193 $ content = $ this ->getUrlContents ($ url );
@@ -269,20 +257,13 @@ private function executeQuery(string $url, int $limit): Collection
269257 return new AddressCollection ($ results );
270258 }
271259
272- /**
273- * {@inheritdoc}
274- */
275260 public function getName (): string
276261 {
277262 return 'Here ' ;
278263 }
279264
280265 /**
281266 * Get serialized additional data param.
282- *
283- * @param GeocodeQuery $query
284- *
285- * @return string
286267 */
287268 private function getAdditionalDataParam (GeocodeQuery $ query ): string
288269 {
@@ -301,16 +282,12 @@ private function getAdditionalDataParam(GeocodeQuery $query): string
301282
302283 /**
303284 * Add API credentials to query params.
304- *
305- * @param array $queryParams
306- *
307- * @return array
308285 */
309286 private function withApiCredentials (array $ queryParams ): array
310287 {
311288 if (
312- empty ($ this ->apiKey ) &&
313- (empty ($ this ->appId ) || empty ($ this ->appCode ))
289+ empty ($ this ->apiKey )
290+ && (empty ($ this ->appId ) || empty ($ this ->appCode ))
314291 ) {
315292 throw new InvalidCredentials ('Invalid or missing api key. ' );
316293 }
@@ -346,10 +323,6 @@ public function getBaseUrl(Query $query): string
346323
347324 /**
348325 * Serialize the component query parameter.
349- *
350- * @param array $components
351- *
352- * @return string
353326 */
354327 private function serializeComponents (array $ components ): string
355328 {
0 commit comments