X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6a7e0d652b1d40a397e1c1386d500101796676c4..a79c1bda9b77635e31f228e031ecbb6465f8dff4:/lib-php/AddressDetails.php diff --git a/lib-php/AddressDetails.php b/lib-php/AddressDetails.php index 3d17ede5..35786d22 100644 --- a/lib-php/AddressDetails.php +++ b/lib-php/AddressDetails.php @@ -1,4 +1,12 @@ addSubdivisionCode($aAddress, $sTypeLabel, $aLine['name']); } } } @@ -168,4 +178,14 @@ class AddressDetails { return $this->aAddressLines; } + + private function addSubdivisionCode(&$aAddress, $sTypeLabel, $nameDetails) + { + if (is_string($nameDetails)) { + $nameDetails = json_decode('{' . str_replace('"=>"', '":"', $nameDetails) . '}', true); + } + if (!empty($nameDetails['ISO3166-2'])) { + $aAddress["$sTypeLabel-ISO3166-2"] = $nameDetails['ISO3166-2']; + } + } }