/**
  * Format address in a specific way
  *
  * @param DataObject $storeInfo
  * @param string $type
  * @return string
  */
 public function format(DataObject $storeInfo, $type = 'html')
 {
     $this->eventManager->dispatch('store_address_format', ['type' => $type, 'store_info' => $storeInfo]);
     $address = $this->filterManager->template("{{var name}}\n{{var street_line1}}\n{{depend street_line2}}{{var street_line2}}\n{{/depend}}" . "{{var city}}, {{var region}} {{var postcode}},\n{{var country}}", ['variables' => $storeInfo->getData()]);
     if ($type == 'html') {
         $address = nl2br($address);
     }
     return $address;
 }
 /**
  * Retrieve processed template subject
  *
  * @param array $variables
  * @return string
  */
 public function getProcessedTemplateSubject(array $variables)
 {
     if (!$this->_preprocessFlag) {
         $variables['this'] = $this;
     }
     return $this->_filterManager->template($this->getTemplateSubject(), ['variables' => $variables]);
 }