CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface::get PHP Method

get() public method

Returns an address format instance matching the provided country code.
public get ( string $countryCode ) : AddressFormat
$countryCode string The country code.
return AddressFormat The address format instance.
    public function get($countryCode);

Usage Example

 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value instanceof AddressInterface) {
         throw new UnexpectedTypeException($value, 'AddressInterface');
     }
     $address = $value;
     $countryCode = $address->getCountryCode();
     if ($countryCode === null || $countryCode === '') {
         return;
     }
     $values = $this->extractAddressValues($address);
     $addressFormat = $this->addressFormatRepository->get($address->getCountryCode());
     $this->validateFields($values, $addressFormat, $constraint);
     $subdivisions = $this->validateSubdivisions($values, $addressFormat, $constraint);
     $this->validatePostalCode($address->getPostalCode(), $subdivisions, $addressFormat, $constraint);
 }
All Usage Examples Of CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface::get
AddressFormatRepositoryInterface