<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rocketfellows / country-vat-number-format-validators-config example snippets
/**
* FirstRUVatNumberValidator and SecondRUVatNumberValidator are implemented CountryVatFormatValidatorInterface
*/
$validators = new CountryVatFormatValidators(new FirstRUVatNumberValidator(), new SecondRUVatNumberValidator());
$config = new CountryVatNumberValidatorsConfig(Country::RU(), $validators);
$config->getCountry(); // will return RU country object
$config->getValidators(); // will return $validators tuple
// implements CountryVatNumberFormatValidatorsConfigInterface
$ruVatNumberFormatValidatorsConfig = new CountryVatNumberValidatorsConfig(
Country::RU(),
new CountryVatFormatValidators(new RUVatNumberFormatValidator())
);
// implements CountryVatNumberFormatValidatorsConfigInterface
$deVatNumberFormatValidatorsConfig = new CountryVatNumberValidatorsConfig(
Country::DE(),
new CountryVatFormatValidators(new DEVatNumberFormatValidator())
);
// implements CountryVatNumberFormatValidatorsConfigInterface
$atVatNumberFormatValidatorsConfig = new CountryVatNumberValidatorsConfig(
Country::AT(),
new CountryVatFormatValidators(new ATVatNumberFormatValidator())
);
$configs = new CountryVatNumberFormatValidatorsConfigs(
$ruVatNumberFormatValidatorsConfig,
$deVatNumberFormatValidatorsConfig,
$atVatNumberFormatValidatorsConfig
);
// each $config variable is an instance of CountryVatNumberFormatValidatorsConfigInterface
foreach ($configs as $config) {
$config->getCountry(); // returns Country of current config
$config->getValidators(); // return CountryVatFormatValidators of current config
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.