Property | Type | Description | |
---|---|---|---|
$addressFormatRepository | CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface | The address format repository. | |
$countryRepository | CommerceGuys\Addressing\Country\CountryRepositoryInterface | The country repository. | |
$locale | string | The locale. | |
$options | array | The options. | |
$subdivisionRepository | CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface | The subdivision repository. |
Method | Description | |
---|---|---|
__construct ( CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface $addressFormatRepository, CommerceGuys\Addressing\Country\CountryRepositoryInterface $countryRepository, CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface $subdivisionRepository, string $locale = null, array $options = [] ) | Creates a DefaultFormatter instance. | |
format ( CommerceGuys\Addressing\AddressInterface $address ) | ||
getLocale ( ) | ||
getOption ( $key ) | ||
getOptions ( ) | ||
setLocale ( $locale ) | ||
setOption ( $key, $value ) | ||
setOptions ( array $options ) |
Method | Description | |
---|---|---|
buildView ( CommerceGuys\Addressing\AddressInterface $address, |
Builds the view for the given address. | |
cleanupOutput ( string $output ) : string | Removes empty lines, leading punctuation, excess whitespace. | |
getDefaultOptions ( ) : array | Gets the default options. | |
getValues ( CommerceGuys\Addressing\AddressInterface $address, |
Gets the address values used to build the view. | |
renderAttributes ( array $attributes ) : string | Renders the given attributes. | |
renderView ( array $view ) : array | Renders the given view. |
public __construct ( CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface $addressFormatRepository, CommerceGuys\Addressing\Country\CountryRepositoryInterface $countryRepository, CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface $subdivisionRepository, string $locale = null, array $options = [] ) | ||
$addressFormatRepository | CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface | |
$countryRepository | CommerceGuys\Addressing\Country\CountryRepositoryInterface | |
$subdivisionRepository | CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface | |
$locale | string | |
$options | array |
protected cleanupOutput ( string $output ) : string | ||
$output | string | The output that needs cleanup. |
return | string | The cleaned up output. |
public format ( CommerceGuys\Addressing\AddressInterface $address ) | ||
$address | CommerceGuys\Addressing\AddressInterface |
protected getDefaultOptions ( ) : array | ||
return | array | The default options. |
protected getValues ( CommerceGuys\Addressing\AddressInterface $address, |
||
$address | CommerceGuys\Addressing\AddressInterface | The address. |
$addressFormat | The address format. | |
return | array | The values, keyed by address field. |
protected renderAttributes ( array $attributes ) : string | ||
$attributes | array | The attributes. |
return | string | The rendered attributes. |
protected renderView ( array $view ) : array | ||
$view | array | The view. |
return | array | An array of rendered values with the original keys preserved. |
protected AddressFormatRepositoryInterface,CommerceGuys\Addressing\AddressFormat $addressFormatRepository | ||
return | CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface |
protected CountryRepositoryInterface,CommerceGuys\Addressing\Country $countryRepository | ||
return | CommerceGuys\Addressing\Country\CountryRepositoryInterface |