rocketfellows/country-vat-format-validator-interface

v1.1.0 2023-04-01 17:36 UTC

This package is not auto-updated.

Last update: 2024-10-27 00:40:29 UTC


README

Code Coverage Badge

This component provides interface for implementing vat format validators for different countries.

Consist of:

  • CountryVatFormatValidatorInterface - main interface for country vat format validator.
  • CountryVatFormatValidator - abstract country vat format validator, a class that enforces an interface contract.
  • CountryVatFormatEmptinessValidator - simple country vat format validator, example of implementation CountryVatFormatValidatorInterface, also provides only emptiness validation if for some country format not essential for some reason.
  • CountryVatFormatValidators - CountryVatFormatValidatorInterface tuple implementation.

Installation

composer require rocketfellows/country-vat-format-validator-interface

CountryVatFormatValidatorInterface description

CountryVatFormatValidatorInterface has one function isValid that takes string vat number as parameter. Interface implementations must handle inner exceptions and throws exceptions:

  • CountryVatFormatValidationException

CountryVatFormatValidator description

CountryVatFormatValidator enforces an CountryVatFormatValidatorInterface contract, handling all exceptions and throws CountryVatFormatValidationException. Inheritors must implement abstract function isValidFormat wherein all validation must be written.

Example of inheritor: CountryVatFormatEmptinessValidator

CountryVatFormatEmptinessValidator description

CountryVatFormatEmptinessValidator simple country vat format validator, example of implementation CountryVatFormatValidatorInterface. Also provides only emptiness validation if for some country format not essential for some reason.

May serve as an example of other country vat format validators implementations.

CountryVatFormatValidators description

CountryVatFormatValidators - CountryVatFormatValidatorInterface tuple implementation. Represents an immutable tuple of objects of type CountryVatFormatValidatorInterface.

Contributing

Welcome to pull requests. If there is a major changes, first please open an issue for discussion.

Please make sure to update tests as appropriate.