public function format(
        AddressInterface $address,
        $locale = null,
        $html = true,
        $htmlTag = "p",
        $htmlAttributes = []
    ) {
        $locale = $this->normalizeLocale($locale);

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

        $formatter = new DefaultFormatter(
            $addressFormatRepository,
            $countryRepository,
            $subdivisionRepository,
            $locale
        );

        $formatter->setOption('html', $html);
        $formatter->setOption('html_tag', $htmlTag);
        $formatter->setOption('html_attributes', $htmlAttributes);


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

        return $addressFormatted;
    }
public function format(
        AddressInterface $address,
        $locale = null,
        $html = true,
        $htmlTag = "p",
        $htmlAttributes = []
    ) {
        $locale = $this->normalizeLocale($locale);

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

        $formatter = new DefaultFormatter(
            $addressFormatRepository,
            $countryRepository,
            $subdivisionRepository,
            $locale
        );

        $formatter->setOption('html', $html);
        $formatter->setOption('html_tag', $htmlTag);
        $formatter->setOption('html_attributes', $htmlAttributes);


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

        return $addressFormatted;
    }
public function format ( AddressInterface $ address , $ locale = null , $ html = true , $ htmlTag = "p" , $ htmlAttributes = [ ] ) { $ locale = $ this -> normalizeLocale ( $ locale ) ; $ addressFormatRepository = new AddressFormatRepository ( ) ; $ countryRepository = new CountryRepository ( ) ; $ subdivisionRepository = new SubdivisionRepository ( ) ; $ formatter = new DefaultFormatter ( $ addressFormatRepository , $ countryRepository , $ subdivisionRepository , $ locale ) ; $ formatter -> setOption ( 'html' , $ html ) ; $ formatter -> setOption ( 'html_tag' , $ htmlTag ) ; $ formatter -> setOption ( 'html_attributes' , $ htmlAttributes ) ; $ addressFormatted = $ formatter -> format ( $ address ) ; return $ addressFormatted ; }
Format an address

@param AddressInterface $address
@param null $locale
@param bool $html
@param string $htmlTag
@param array $htmlAttributes
@return string
Format an address