$data =
json_decode(json_encode($country), true
);
$data =
array_merge($data,
[ 'countryname' =>
$country->
getName(),
'countryiso' =>
$country->
getIso(),
'countryen' =>
$country->
getEn(),
'position' =>
$country->
getPosition(),
'taxfree' =>
$country->
isTaxFree(),
'taxfree_ustid' =>
$country->
isTaxFreeForVatId(),
'taxfree_ustid_checked' =>
$country->
checkVatId(),
'active' =>
$country->
isActive(),
'iso3' =>
$country->
getIso3(),
'display_state_in_registration' =>
$country->
displayStateSelection(),
'force_state_in_registration' =>
$country->
requiresStateSelection(),
'areaID' =>
$country->
getAreaId(),
'allow_shipping' =>
$country->
allowShipping(),
'states' =>
[],
'attributes' =>
$country->
getAttributes(),
]);
if ($country->
displayStateSelection()) { $data['states'
] =
$this->
convertStateStructList($country->
getStates());
$data['states'
] =
array_map(function D
$state) use ($country) { $state['countryID'
] =
$country->
getId();