Skip to content

Commit

Permalink
[CVFV-31] updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
arslanim committed Apr 29, 2023
1 parent b6ba8e1 commit 67ae9c0
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# <Country> vat number format validators config
# Sweden vat number format validators config

![Code Coverage Badge](./badge.svg)

This package provides a preconfigured configuration class for vat number format validators for <Country> country.
This package provides a preconfigured configuration class for vat number format validators for Sweden country.
Is an extension of the package https://github.com/rocketfellows/specific-country-vat-number-format-validators-config.

## Installation

```shell
composer require rocketfellows/<country>-vat-number-format-validators-config
composer require rocketfellows/se-vat-number-format-validators-config
```

## Dependencies

- https://github.com/rocketfellows/specific-country-vat-number-format-validators-config v1.0.0;
- https://github.com/rocketfellows/<country>-vat-format-validator v1.0.0;
- https://github.com/rocketfellows/se-vat-format-validator v1.0.0;

## References

Expand All @@ -23,31 +23,31 @@ composer require rocketfellows/<country>-vat-number-format-validators-config

## List of package components

- **_rocketfellows\<country>VatNumberFormatValidatorsConfig\<country>VatNumberFormatValidatorsConfig_** - preconfigured configuration class for vat number format validators for <Country> country;
- **_rocketfellows\SEVatNumberFormatValidatorsConfig\SEVatNumberFormatValidatorsConfig_** - preconfigured configuration class for vat number format validators for Sweden country;

## <country>VatNumberFormatValidatorsConfig description
## SEVatNumberFormatValidatorsConfig description

A configuration class that provides a match for the vat number format validators for the country <country>.
A configuration class that provides a match for the vat number format validators for the country Sweden.

Class interface:
- **_getCountry_** - returns <country> **_Country_** instance;
- **_getCountry_** - returns Sweden **_Country_** instance;
- **_getValidators_** - returns validators tuple

When initializing the default configuration, the **_getValidators_** function returns a tuple with a single validator - an instance of <country>VatFormatValidator.
When initializing the default configuration, the **_getValidators_** function returns a tuple with a single validator - an instance of SEVatFormatValidator.

```php
$config = new <country>VatNumberFormatValidatorsConfig();
$config = new SEVatNumberFormatValidatorsConfig();

$config->getCountry(); // returns <country> Country instance
$config->getValidators(); // returns CountryVatFormatValidators with one item - instance of <country>VatFormatValidator
$config->getCountry(); // returns Sweden Country instance
$config->getValidators(); // returns CountryVatFormatValidators with one item - instance of SEVatFormatValidator
```

You can override the default validator by initializing the configuration class object with a new default validator through the first parameter of the class constructor.
Attention - validator must implement interface **_CountryVatFormatValidatorInterface_**.

```php
$newDefaultValidator = new NewDefaultValidator(); // instance of CountryVatFormatValidatorInterface
$config = new <country>VatNumberFormatValidatorsConfig($newDefaultValidator); // initialize with new default validator
$config = new SEVatNumberFormatValidatorsConfig($newDefaultValidator); // initialize with new default validator

$config->getValidators(); // returns CountryVatFormatValidators with one item - $newDefaultValidator
```
Expand All @@ -61,7 +61,7 @@ And each additional validator must implement interface **_CountryVatFormatValida
$firstAdditionalValidator = new FirstAdditionalValidator(); // instance of CountryVatFormatValidatorInterface
$secondAdditionalValidator = new SecondAdditionalValidator(); // instance of CountryVatFormatValidatorInterface

$config = new <country>VatNumberFormatValidatorsConfig(
$config = new SEVatNumberFormatValidatorsConfig(
null,
(
new CountryVatFormatValidators(
Expand All @@ -72,7 +72,7 @@ $config = new <country>VatNumberFormatValidatorsConfig(
);

// returns CountryVatFormatValidators with three items:
// default preconfigured validator by default - instance of <country>VatFormatValidator
// default preconfigured validator by default - instance of SEVatFormatValidator
// $firstAdditionalValidator - from additional tuple
// $secondAdditionalValidator - from additional tuple
$config->getValidators();
Expand All @@ -85,7 +85,7 @@ $defaultValidator = new DefaultValidator(); // instance of Cou
$firstAdditionalValidator = new FirstAdditionalValidator(); // instance of CountryVatFormatValidatorInterface
$secondAdditionalValidator = new SecondAdditionalValidator(); // instance of CountryVatFormatValidatorInterface

$config = new <country>VatNumberFormatValidatorsConfig(
$config = new SEVatNumberFormatValidatorsConfig(
$defaultValidator,
(
new CountryVatFormatValidators(
Expand Down

0 comments on commit 67ae9c0

Please sign in to comment.