@@ -113,35 +113,35 @@ public function geocodeQuery(GeocodeQuery $query): Collection
113
113
*/
114
114
public function reverseQuery (ReverseQuery $ query ): Collection
115
115
{
116
- $ coordinates = $ query ->getCoordinates ();
116
+ $ coordinates = $ query ->getCoordinates ();
117
117
118
- $ jsonQuery = [
118
+ $ jsonQuery = [
119
119
'language ' => $ query ->getLocale (),
120
- 'point ' => [
120
+ 'point ' => [
121
121
'x ' => $ coordinates ->getLongitude (),
122
- 'y ' => $ coordinates ->getLatitude ()
122
+ 'y ' => $ coordinates ->getLatitude (),
123
123
],
124
- 'spatialReference ' => 4326
124
+ 'spatialReference ' => 4326 ,
125
125
];
126
126
127
- $ url = sprintf (self ::REVERSE_ENDPOINT_URL , urlencode (json_encode ($ jsonQuery )));
128
- $ json = $ this ->executeQuery ($ url );
129
-
130
- // no result
131
- if (empty ($ json ->result )) {
132
- return new AddressCollection ([]);
133
- }
127
+ $ url = sprintf (self ::REVERSE_ENDPOINT_URL , urlencode (json_encode ($ jsonQuery )));
128
+ $ json = $ this ->executeQuery ($ url );
134
129
135
- $ results = [];
136
- $ location = $ json ->result ;
137
- $ coordinates = $ location ->point ;
138
- $ streetName = !empty ($ location ->address ->street ->name ) ? $ location ->address ->street ->name : null ;
139
- $ number = !empty ($ location ->address ->number ) ? $ location ->address ->number : null ;
140
- $ municipality = !empty ($ location ->address ->street ->municipality ) ? $ location ->address ->street ->municipality : null ;
141
- $ postCode = !empty ($ location ->address ->street ->postCode ) ? $ location ->address ->street ->postCode : null ;
142
- $ countryCode = 'BE ' ;
130
+ // no result
131
+ if (empty ($ json ->result )) {
132
+ return new AddressCollection ([]);
133
+ }
143
134
144
- $ results [] = Address::createFromArray ([
135
+ $ results = [];
136
+ $ location = $ json ->result ;
137
+ $ coordinates = $ location ->point ;
138
+ $ streetName = !empty ($ location ->address ->street ->name ) ? $ location ->address ->street ->name : null ;
139
+ $ number = !empty ($ location ->address ->number ) ? $ location ->address ->number : null ;
140
+ $ municipality = !empty ($ location ->address ->street ->municipality ) ? $ location ->address ->street ->municipality : null ;
141
+ $ postCode = !empty ($ location ->address ->street ->postCode ) ? $ location ->address ->street ->postCode : null ;
142
+ $ countryCode = 'BE ' ;
143
+
144
+ $ results [] = Address::createFromArray ([
145
145
'providedBy ' => $ this ->getName (),
146
146
'latitude ' => $ coordinates ->y ,
147
147
'longitude ' => $ coordinates ->x ,
@@ -152,7 +152,7 @@ public function reverseQuery(ReverseQuery $query): Collection
152
152
'countryCode ' => $ countryCode ,
153
153
]);
154
154
155
- return new AddressCollection ($ results );
155
+ return new AddressCollection ($ results );
156
156
}
157
157
158
158
/**
0 commit comments