rocketfellows / country-vat-format-validator-interface
Installs: 1 267
Dependents: 33
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: >=7.4
- rocketfellows/tuple: ^1.0
Requires (Dev)
- phpstan/phpstan: ^0.12.90
- phpunit/phpunit: ^8.5
- squizlabs/php_codesniffer: 3.6.2
This package is not auto-updated.
Last update: 2024-10-27 00:40:29 UTC
README
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.