@@ -41,20 +41,6 @@ final class Here extends AbstractHttpProvider
41
41
*/
42
42
public const REVERSE_ENDPOINT_URL = 'https://revgeocode.search.hereapi.com/v1/revgeocode ' ;
43
43
44
- /**
45
- * @var string[]
46
- */
47
- public const GEOCODE_QUALIFIED_QUERY_PARAMS = [
48
- 'houseNumber ' ,
49
- 'street ' ,
50
- 'city ' ,
51
- 'district ' ,
52
- 'county ' ,
53
- 'state ' ,
54
- 'country ' ,
55
- 'postalCode ' ,
56
- ];
57
-
58
44
/**
59
45
* @var string[]
60
46
*/
@@ -153,23 +139,10 @@ public function geocodeQuery(GeocodeQuery $query): Collection
153
139
154
140
$ queryParams = $ this ->withApiCredentials ([]);
155
141
156
- if ($ queryString = $ query ->getText ()) {
157
- $ queryParams ['q ' ] = $ queryString ;
158
- }
159
-
160
- foreach ($ this ::GEOCODE_QUALIFIED_QUERY_PARAMS as $ param ) {
161
- if ($ data = $ query ->getData ($ param )) {
162
- if (!\array_key_exists ('qq ' , $ queryParams )) {
163
- $ queryParams ['qq ' ] = '' ;
164
- } else {
165
- $ queryParams ['qq ' ] .= '; ' ;
166
- }
167
- $ queryParams ['qq ' ] .= $ param .'= ' .$ data ;
168
- }
169
- }
170
-
171
- if (!\array_key_exists ('q ' , $ queryParams ) && !\array_key_exists ('qq ' , $ queryParams )) {
172
- throw new InvalidArgument ('Query q or Qualified Query qq is required ' );
142
+ if (true === $ query ->getData ('qq ' )) {
143
+ $ queryParams ['qq ' ] = $ query ->getText ();
144
+ } else {
145
+ $ queryParams ['q ' ] = $ query ->getText ();
173
146
}
174
147
175
148
if ($ center = $ query ->getData ('centerOn ' )) {
@@ -306,12 +279,12 @@ private function executeQuery(string $url, int $limit): Collection
306
279
$ builder ->setTimezone ($ location ['timeZone ' ]['name ' ] ?? null );
307
280
308
281
$ additionalData = [
309
- ' countryInfo ' => $ location ['countryInfo ' ] ?? null ,
310
- ' parsing ' => $ location ['parsing ' ] ?? null ,
311
- ' streetInfo ' => $ location ['streetInfo ' ] ?? null ,
312
- ' postalCodeDetails ' => $ location ['postalCodeDetails ' ] ?? null ,
313
- ' mapReferences ' => $ location ['mapReferences ' ] ?? null ,
314
- ' navigationAttributes ' => $ location ['navigationAttributes ' ] ?? null ,
282
+ [ ' key ' => ' countryInfo ', ' value ' => $ location ['countryInfo ' ] ?? null ] ,
283
+ [ ' key ' => ' parsing ', ' value ' => $ location ['parsing ' ] ?? null ] ,
284
+ [ ' key ' => ' streetInfo ', ' value ' => $ location ['streetInfo ' ] ?? null ] ,
285
+ [ ' key ' => ' postalCodeDetails ', ' value ' => $ location ['postalCodeDetails ' ] ?? null ] ,
286
+ [ ' key ' => ' mapReferences ', ' value ' => $ location ['mapReferences ' ] ?? null ] ,
287
+ [ ' key ' => ' navigationAttributes ', ' value ' => $ location ['navigationAttributes ' ] ?? null ] ,
315
288
];
316
289
317
290
/** @var HereAddress $address */
0 commit comments