protected function buildView(AddressInterface $address, AddressFormat $addressFormat)
{
$countries = $this->countryRepository->getList($this->locale);
$values = $this->getValues($address, $addressFormat);
$view = [];
$view['country'] = ['html_tag' => 'span', 'html_attributes' => ['class' => 'country'], 'value' => $countries[$address->getCountryCode()]];
foreach ($addressFormat->getUsedFields() as $field) {
// The constant is more suitable as a class than the value since
// it's snake_case and not camelCase.
$class = str_replace('_', '-', strtolower(AddressField::getKey($field)));
$view[$field] = ['html_tag' => 'span', 'html_attributes' => ['class' => $class], 'value' => $values[$field]];
}
return $view;
}