$address =
$this->
get(ModelManager::
class)->
find(Address::
class,
$addressId);
if (!
$address instanceof Address || !
$address->
getCountry() instanceof Country
) { $this->
View()->
assign('invalidShippingCountry', true
);
return false;
} $context =
$this->
get(ContextServiceInterface::
class)->
getContext();
$country =
$this->
get(CountryGatewayInterface::
class)->
getCountry($address->
getCountry()->
getId(),
$context);
if ($isShippingAddress && !
$country->
allowShipping()) { $this->
View()->
assign('invalidShippingCountry', true
);
return false;
} return $this->
get(AddressValidatorInterface::
class)->
isValid($address);
} /**
* @return array<string, mixed>
*/