PHP Class CommerceGuys\Addressing\Validator\Constraints\AddressFormatConstraintValidator

Inheritance: extends Symfony\Component\Validator\ConstraintValidator
Afficher le fichier Open project: commerceguys/addressing

Protected Properties

Свойство Type Description
$addressFormatRepository CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface The address format repository.
$subdivisionRepository CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface The subdivision repository.

Méthodes publiques

Méthode Description
__construct ( CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface $addressFormatRepository = null, CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface $subdivisionRepository = null ) Creates an AddressFormatValidator instance.
validate ( $value, Constraint $constraint )

Méthodes protégées

Méthode Description
addViolation ( string $field, string $message, mixed $invalidValue, AddressFormat $addressFormat ) Adds a violation.
extractAddressValues ( CommerceGuys\Addressing\AddressInterface $address ) : array Extracts the address values.
validateFields ( array $values, AddressFormat $addressFormat, Constraint $constraint ) Validates the provided field values.
validatePostalCode ( string $postalCode, array $subdivisions, AddressFormat $addressFormat, Constraint $constraint ) Validates the provided postal code.
validateSubdivisions ( array $values, AddressFormat $addressFormat, Constraint $constraint ) : array Validates the provided subdivision values.

Method Details

__construct() public méthode

Creates an AddressFormatValidator instance.
public __construct ( CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface $addressFormatRepository = null, CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface $subdivisionRepository = null )
$addressFormatRepository CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface
$subdivisionRepository CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface

addViolation() protected méthode

Accounts for differences between Symfony versions.
protected addViolation ( string $field, string $message, mixed $invalidValue, AddressFormat $addressFormat )
$field string The field.
$message string The error message.
$invalidValue mixed The invalid, validated value.
$addressFormat CommerceGuys\Addressing\AddressFormat\AddressFormat The address format.

extractAddressValues() protected méthode

Extracts the address values.
protected extractAddressValues ( CommerceGuys\Addressing\AddressInterface $address ) : array
$address CommerceGuys\Addressing\AddressInterface The address.
Résultat array An array of values keyed by field constants.

validate() public méthode

public validate ( $value, Constraint $constraint )
$constraint Symfony\Component\Validator\Constraint

validateFields() protected méthode

Validates the provided field values.
protected validateFields ( array $values, AddressFormat $addressFormat, Constraint $constraint )
$values array The field values, keyed by field constants.
$addressFormat CommerceGuys\Addressing\AddressFormat\AddressFormat The address format.
$constraint Symfony\Component\Validator\Constraint The constraint.

validatePostalCode() protected méthode

Validates the provided postal code.
protected validatePostalCode ( string $postalCode, array $subdivisions, AddressFormat $addressFormat, Constraint $constraint )
$postalCode string The postal code.
$subdivisions array An array of found valid subdivisions.
$addressFormat CommerceGuys\Addressing\AddressFormat\AddressFormat The address format.
$constraint Symfony\Component\Validator\Constraint The constraint.

validateSubdivisions() protected méthode

Validates the provided subdivision values.
protected validateSubdivisions ( array $values, AddressFormat $addressFormat, Constraint $constraint ) : array
$values array The field values, keyed by field constants.
$addressFormat CommerceGuys\Addressing\AddressFormat\AddressFormat The address format.
$constraint Symfony\Component\Validator\Constraint The constraint.
Résultat array An array of found valid subdivisions.

Property Details

$addressFormatRepository protected_oe property

The address format repository.
protected AddressFormatRepositoryInterface,CommerceGuys\Addressing\AddressFormat $addressFormatRepository
Résultat CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface

$subdivisionRepository protected_oe property

The subdivision repository.
protected SubdivisionRepositoryInterface,CommerceGuys\Addressing\Subdivision $subdivisionRepository
Résultat CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface