Skip to content

Commit 923666f

Browse files
authored
Merge pull request #1 from rocketfellows/CVFV-6
https://tracker.yandex.ru/CVFV-6
2 parents f0b2666 + 5641fb2 commit 923666f

9 files changed

+1757
-99
lines changed

README.md

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,8 @@
1-
# Country vat format validator template description
2-
3-
## Implementation steps
4-
5-
1. Create repository use template for name: <ISO-3166-standard-alpha2-code>-vat-format-validator
6-
2. Update composer.json **name** attribute: rocketfellows/<ISO-3166-standard-alpha2-code>-vat-format-validator
7-
3. Update composer.json with autoload and autoload-dev sections by pattern:
8-
```php
9-
"autoload": {
10-
"psr-4": {
11-
"rocketfellows\\<ISO-3166-standard-alpha2-code>VatFormatValidator\\": "src/"
12-
}
13-
},
14-
"autoload-dev": {
15-
"psr-4": {
16-
"rocketfellows\\<ISO-3166-standard-alpha2-code>VatFormatValidator\\tests\\": "tests/"
17-
}
18-
}
19-
```
20-
3. Run docker-deploy.sh
21-
4. Implement unit test in test/unit directory
22-
5. Implement direct validator
23-
24-
# Templated readme
25-
26-
# <Country> vat format validator
1+
# Hungary vat format validator
272

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

30-
This component provides <Country> vat number format validator.
5+
This component provides Hungary vat number format validator.
316

327
Implementation of interface **rocketfellows\CountryVatFormatValidatorInterface\CountryVatFormatValidatorInterface**
338

@@ -36,42 +11,53 @@ Depends on https://github.com/rocketfellows/country-vat-format-validator-interfa
3611
## Installation
3712

3813
```shell
39-
composer require rocketfellows/<ISO-3166-standard-alpha2-code>-vat-format-validator
14+
composer require rocketfellows/hu-vat-format-validator
4015
```
4116

4217
## Usage example
4318

44-
Valid <Country> vat number:
19+
Valid Hungary vat number:
4520

4621
```php
47-
$validator = new <Country>VatFormatValidator();
48-
$validator->isValid('');
49-
$validator->isValid('');
22+
$validator = new HUVatFormatValidator();
23+
$validator->isValid('HU12345678');
24+
$validator->isValid('HU99999999');
25+
$validator->isValid('12345678');
26+
$validator->isValid('99999999');
5027
```
5128

5229
Returns:
5330

5431
```shell
5532
true
5633
true
34+
true
35+
true
5736
```
5837

59-
Invalid <Country> vat number:
38+
Invalid Hungary vat number:
6039

6140
```php
62-
$validator = new <Country>VatFormatValidator();
63-
$validator->isValid('');
41+
$validator = new HUVatFormatValidator();
42+
$validator->isValid('HU123456789');
43+
$validator->isValid('HU1234567');
44+
$validator->isValid('123456789');
45+
$validator->isValid('1234567');
46+
$validator->isValid('DE12345678');
6447
$validator->isValid('');
6548
```
6649

6750
```shell
6851
false
6952
false
53+
false
54+
false
55+
false
56+
false
7057
```
7158

7259
## Contributing
7360

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

7663
Please make sure to update tests as appropriate.
77-

badge.svg

Lines changed: 4 additions & 4 deletions
Loading

clover.xml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<coverage generated="1648587867">
3-
<project timestamp="1648587867">
4-
<metrics files="0" loc="0" ncloc="0" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
2+
<coverage generated="1678293003">
3+
<project timestamp="1678293003">
4+
<file name="/app/src/HUVatFormatValidator.php">
5+
<class name="rocketfellows\HUVatFormatValidator\HUVatFormatValidator" namespace="global">
6+
<metrics complexity="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="1" coveredstatements="1" elements="2" coveredelements="2"/>
7+
</class>
8+
<line num="11" type="method" name="isValidFormat" visibility="protected" complexity="1" crap="1" count="16"/>
9+
<line num="13" type="stmt" count="16"/>
10+
<metrics loc="16" ncloc="16" classes="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="1" coveredstatements="1" elements="2" coveredelements="2"/>
11+
</file>
12+
<metrics files="1" loc="16" ncloc="16" classes="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="1" coveredstatements="1" elements="2" coveredelements="2"/>
513
</project>
614
</coverage>

composer.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "rocketfellows/country-vat-format-validator-template",
2+
"name": "rocketfellows/hu-vat-format-validator",
33
"authors": [
44
{
55
"name": "Arslan Imamutdinov",
@@ -15,5 +15,15 @@
1515
"phpunit/phpunit": "^8.5",
1616
"phpstan/phpstan": "^0.12.90",
1717
"squizlabs/php_codesniffer": "3.6.2"
18+
},
19+
"autoload": {
20+
"psr-4": {
21+
"rocketfellows\\HUVatFormatValidator\\": "src/"
22+
}
23+
},
24+
"autoload-dev": {
25+
"psr-4": {
26+
"rocketfellows\\HUVatFormatValidator\\tests\\": "tests/"
27+
}
1828
}
1929
}

0 commit comments

Comments
 (0)