@@ -58,40 +58,40 @@ public function geocodeQuery(GeocodeQuery $query): Collection
5858 throw new InvalidArgument ('Address cannot be empty. ' );
5959 }
6060
61- $ request = array () ;
62- $ request ['ValidateAddressesRequest ' ] = array (
63- 'AddressToValidateList ' => array (
64- 'AddressToValidate ' => array (
65- array (
66- '@id ' => 1 ,
67- 'PostalAddress ' => array (
68- 'DeliveryPointLocation ' => array (
69- 'StructuredDeliveryPointLocation ' => array (
70- 'StreetName ' => $ query ->getData ('streetName ' ),
71- 'StreetNumber ' => $ query ->getData ('streetNumber ' )
72- )
73- ) ,
74- 'PostalCodeMunicipality ' => array (
75- 'StructuredPostalCodeMunicipality ' => array (
76- 'PostalCode ' => $ query ->getData ('postalCode ' , '' ),
77- 'MunicipalityName ' => $ query ->getData ('locality ' , '' )
78- )
79- )
80- ) ,
81- 'DeliveringCountryISOCode ' => 'BE ' ,
82- 'DispatchingCountryISOCode ' => 'BE '
83- )
84- )
85- ) ,
86- 'ValidateAddressOptions ' => array (
87- 'IncludeSuggestions ' => false ,
61+ $ request = [] ;
62+ $ request ['ValidateAddressesRequest ' ] = [
63+ 'AddressToValidateList ' => [
64+ 'AddressToValidate ' => [
65+ [
66+ '@id ' => 1 ,
67+ 'PostalAddress ' => [
68+ 'DeliveryPointLocation ' => [
69+ 'StructuredDeliveryPointLocation ' => [
70+ 'StreetName ' => $ query ->getData ('streetName ' ),
71+ 'StreetNumber ' => $ query ->getData ('streetNumber ' ),
72+ ],
73+ ] ,
74+ 'PostalCodeMunicipality ' => [
75+ 'StructuredPostalCodeMunicipality ' => [
76+ 'PostalCode ' => $ query ->getData ('postalCode ' , '' ),
77+ 'MunicipalityName ' => $ query ->getData ('locality ' , '' ),
78+ ],
79+ ],
80+ ] ,
81+ 'DeliveringCountryISOCode ' => 'BE ' ,
82+ 'DispatchingCountryISOCode ' => 'BE ' ,
83+ ],
84+ ],
85+ ] ,
86+ 'ValidateAddressOptions ' => [
87+ 'IncludeSuggestions ' => false ,
8888 'IncludeDefaultGeoLocation ' => true ,
89- 'IncludeSubmittedAddress ' => true
90- ) ,
91- 'CallerIdentification ' => array (
92- 'CallerName ' => 'Geocoder PHP '
93- )
94- ) ;
89+ 'IncludeSubmittedAddress ' => true ,
90+ ] ,
91+ 'CallerIdentification ' => [
92+ 'CallerName ' => 'Geocoder PHP ' ,
93+ ],
94+ ] ;
9595
9696 $ json = $ this ->executeQuery (self ::GEOCODE_ENDPOINT_URL , json_encode ($ request ));
9797
@@ -163,9 +163,9 @@ private function executeQuery(string $url, string $data): \stdClass
163163 * @param string $url
164164 * @param string $body
165165 *
166- * @return string
167- *
168166 * @throws InvalidServerResponse
167+ *
168+ * @return string
169169 */
170170 protected function postUrlContents (string $ url , string $ body ): string
171171 {
@@ -183,6 +183,7 @@ protected function postUrlContents(string $url, string $body): string
183183 if (empty ($ body )) {
184184 throw InvalidServerResponse::emptyResponse ($ url );
185185 }
186+
186187 return $ body ;
187188 }
188189}
0 commit comments