"city": "London",
"state_district": "Greater London",
"state": "England",
- "ISO3166-2": "GB-ENG",
+ "state-ISO3166-2": "GB-ENG",
"postcode": "SW1A 2DU",
"country": "United Kingdom",
"country_code": "gb"
<city>London</city>
<state_district>Greater London</state_district>
<state>England</state>
- <state_code>ENG</state_code>
+ <state-ISO3166-2>GB-ENG</state_code>
<postcode>SW1A 2DU</postcode>
<country>United Kingdom</country>
<country_code>gb</country_code>
* continent
* country, country_code
- * region, state, state_code, state_district, county
+ * region, state, state-ISO3166-2, state_district, county, county-ISO3166-2
* municipality, city, town, village
* city_district, district, borough, suburb, subdivision
* hamlet, croft, isolated_dwelling
$aAddress[$sTypeLabel] = $sName;
if (!empty($aLine['name'])) {
- $this->addStateCode($aAddress, $sTypeLabel, $aLine['name']);
+ $this->addSubdivisionCode($aAddress, $sTypeLabel, $aLine['name']);
}
}
}
return $this->aAddressLines;
}
- /**
- * Add `state_code` field to address details to represent second part of ISO 3166-2 country subdivision code
- */
- private function addStateCode(&$aAddress, $sTypeLabel, $nameDetails)
+ 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'];
+ $aAddress["$sTypeLabel-ISO3166-2"] = $nameDetails['ISO3166-2'];
}
}
}
'city' => 'London',
'state_district' => 'Greater London',
'state' => 'England',
- 'state:ISO3166-2' => 'GB-ENG',
+ 'state-ISO3166-2' => 'GB-ENG',
'postcode' => 'SW1A 2AA',
'country' => 'United Kingdom',
'country_code' => 'gb'