/**
  * Builds the view for the given address.
  *
  * @param AddressInterface       $address       The address.
  * @param AddressFormatInterface $addressFormat The address format.
  *
  * @return array The view.
  */
 protected function buildView(AddressInterface $address, AddressFormatInterface $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;
 }