public function postalLabelFormat(AddressInterface $address, $locale = null, $originCountry = null, $options = [])
    {
        $locale = $this->normalizeLocale($locale);

        $addressFormatRepository = new AddressFormatRepository();
        $countryRepository = new CountryRepository();
        $subdivisionRepository = new SubdivisionRepository();

        if (null === $originCountry) {
            $countryId = Country::getShopLocation();
            if (null === $country = CountryQuery::create()->findPk($countryId)) {
                $country = Country::getDefaultCountry();
            }

            $originCountry = $country->getIsoalpha2();
        }

        $formatter = new PostalLabelFormatter(
            $addressFormatRepository,
            $countryRepository,
            $subdivisionRepository,
            $originCountry,
            $locale,
            $options
        );

        $addressFormatted = $formatter->format($address);

        return $addressFormatted;
    }
public function postalLabelFormat(AddressInterface $address, $locale = null, $originCountry = null, $options = [])
    {
        $locale = $this->normalizeLocale($locale);

        $addressFormatRepository = new AddressFormatRepository();
        $countryRepository = new CountryRepository();
        $subdivisionRepository = new SubdivisionRepository();

        if (null === $originCountry) {
            $countryId = Country::getShopLocation();
            if (null === $country = CountryQuery::create()->findPk($countryId)) {
                $country = Country::getDefaultCountry();
            }

            $originCountry = $country->getIsoalpha2();
        }

        $formatter = new PostalLabelFormatter(
            $addressFormatRepository,
            $countryRepository,
            $subdivisionRepository,
            $originCountry,
            $locale,
            $options
        );

        $addressFormatted = $formatter->format($address);

        return $addressFormatted;
    }
public function postalLabelFormat ( AddressInterface $ address , $ locale = null , $ originCountry = null , $ options = [ ] ) { $ locale = $ this -> normalizeLocale ( $ locale ) ; $ addressFormatRepository = new AddressFormatRepository ( ) ; $ countryRepository = new CountryRepository ( ) ; $ subdivisionRepository = new SubdivisionRepository ( ) ; if ( null === $ originCountry ) { $ countryId = Country :: getShopLocation ( ) ; if ( null === $ country = CountryQuery :: create ( ) -> findPk ( $ countryId ) ) { $ country = Country :: getDefaultCountry ( ) ; } $ originCountry = $ country -> getIsoalpha2 ( ) ; } $ formatter = new PostalLabelFormatter ( $ addressFormatRepository , $ countryRepository , $ subdivisionRepository , $ originCountry , $ locale , $ options ) ; $ addressFormatted = $ formatter -> format ( $ address ) ; return $ addressFormatted ; }
Format an address to a postal label

@param AddressInterface $address
@param null $locale
@param null $originCountry
@param array $options
@return string
Format an address to a postal label