PHP 클래스 CommerceGuys\Addressing\Formatter\PostalLabelFormatter

Takes care of uppercasing fields where required by the format (to faciliate automated mail sorting). Requires specifying the origin country code, allowing it to differentiate between domestic and international mail. In case of domestic mail, the country name is not displayed at all. In case of international mail: 1. The postal code is prefixed with the destination's postal code prefix. 2. The country name is added to the formatted address, in both the current locale and English. This matches the recommandation given by the Universal Postal Union, to avoid difficulties in countries of transit.
상속: extends DefaultFormatter, implements CommerceGuys\Addressing\Formatter\PostalLabelFormatterInterface
파일 보기 프로젝트 열기: commerceguys/addressing 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$originCountryCode string The origin country code.

공개 메소드들

메소드 설명
__construct ( CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface $addressFormatRepository, CommerceGuys\Addressing\Country\CountryRepositoryInterface $countryRepository, CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface $subdivisionRepository, string $originCountryCode = null, string $locale = null, array $options = [] ) Creates a PostalFormatter instance.
format ( CommerceGuys\Addressing\AddressInterface $address )
getOriginCountryCode ( )
setOriginCountryCode ( $originCountryCode )

보호된 메소드들

메소드 설명
buildView ( CommerceGuys\Addressing\AddressInterface $address, AddressFormat $addressFormat )
getDefaultOptions ( )

메소드 상세

__construct() 공개 메소드

Creates a PostalFormatter instance.
public __construct ( CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface $addressFormatRepository, CommerceGuys\Addressing\Country\CountryRepositoryInterface $countryRepository, CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface $subdivisionRepository, string $originCountryCode = null, string $locale = null, array $options = [] )
$addressFormatRepository CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface
$countryRepository CommerceGuys\Addressing\Country\CountryRepositoryInterface
$subdivisionRepository CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface
$originCountryCode string
$locale string
$options array

buildView() 보호된 메소드

protected buildView ( CommerceGuys\Addressing\AddressInterface $address, AddressFormat $addressFormat )
$address CommerceGuys\Addressing\AddressInterface
$addressFormat CommerceGuys\Addressing\AddressFormat\AddressFormat

format() 공개 메소드

public format ( CommerceGuys\Addressing\AddressInterface $address )
$address CommerceGuys\Addressing\AddressInterface

getDefaultOptions() 보호된 메소드

protected getDefaultOptions ( )

getOriginCountryCode() 공개 메소드

setOriginCountryCode() 공개 메소드

public setOriginCountryCode ( $originCountryCode )

프로퍼티 상세

$originCountryCode 보호되어 있는 프로퍼티

The origin country code.
protected string $originCountryCode
리턴 string