Skip to content

Commit

Permalink
Merge pull request #1 from rocketfellows/CVFV-1
Browse files Browse the repository at this point in the history
  • Loading branch information
arslanim authored Mar 9, 2023
2 parents 2b436b1 + bf6df66 commit 7c9f257
Show file tree
Hide file tree
Showing 9 changed files with 1,812 additions and 100 deletions.
58 changes: 21 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
# Country vat format validator template description

## Implementation steps

1. Create repository use template for name: <ISO-3166-standard-alpha2-code>-vat-format-validator
2. Update composer.json **name** attribute: rocketfellows/<ISO-3166-standard-alpha2-code>-vat-format-validator
3. Update composer.json with autoload and autoload-dev sections by pattern:
```php
"autoload": {
"psr-4": {
"rocketfellows\\<ISO-3166-standard-alpha2-code>VatFormatValidator\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"rocketfellows\\<ISO-3166-standard-alpha2-code>VatFormatValidator\\tests\\": "tests/"
}
}
```
3. Run docker-deploy.sh
4. Implement unit test in test/unit directory
5. Implement direct validator

# Templated readme

# <Country> vat format validator
# Greece vat format validator

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

This component provides <Country> vat number format validator.
This component provides Greece vat number format validator.

Implementation of interface **rocketfellows\CountryVatFormatValidatorInterface\CountryVatFormatValidatorInterface**

Expand All @@ -36,42 +11,51 @@ Depends on https://github.com/rocketfellows/country-vat-format-validator-interfa
## Installation

```shell
composer require rocketfellows/<ISO-3166-standard-alpha2-code>-vat-format-validator
composer require rocketfellows/gr-vat-format-validator
```

## Usage example

Valid <Country> vat number:
Valid Greece vat number:

```php
$validator = new <Country>VatFormatValidator();
$validator->isValid('');
$validator->isValid('');
$validator = new GRVatFormatValidator();
$validator->isValid('123456789');
$validator->isValid('EL123456789');
$validator->isValid('GR123456789');
```

Returns:

```shell
true
true
true
```

Invalid <Country> vat number:
Invalid Greece vat number:

```php
$validator = new <Country>VatFormatValidator();
$validator->isValid('');
$validator->isValid('');
$validator = new GRVatFormatValidator();
$validator->isValid('1234567890');
$validator->isValid('12345678');
$validator->isValid('EL1234567890');
$validator->isValid('EL12345678');
$validator->isValid('GR1234567890');
$validator->isValid('GR12345678');
```

```shell
false
false
false
false
false
false
```

## 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.

8 changes: 4 additions & 4 deletions badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions clover.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1648587867">
<project timestamp="1648587867">
<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"/>
<coverage generated="1678295407">
<project timestamp="1678295407">
<file name="/app/src/GRVatFormatValidator.php">
<class name="rocketfellows\GRVatFormatValidator\GRVatFormatValidator" namespace="global">
<metrics complexity="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="1" coveredstatements="1" elements="2" coveredelements="2"/>
</class>
<line num="11" type="method" name="isValidFormat" visibility="protected" complexity="1" crap="1" count="30"/>
<line num="13" type="stmt" count="30"/>
<metrics loc="16" ncloc="16" classes="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="1" coveredstatements="1" elements="2" coveredelements="2"/>
</file>
<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"/>
</project>
</coverage>
12 changes: 11 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "rocketfellows/country-vat-format-validator-template",
"name": "rocketfellows/gr-vat-format-validator",
"authors": [
{
"name": "Arslan Imamutdinov",
Expand All @@ -15,5 +15,15 @@
"phpunit/phpunit": "^8.5",
"phpstan/phpstan": "^0.12.90",
"squizlabs/php_codesniffer": "3.6.2"
},
"autoload": {
"psr-4": {
"rocketfellows\\GRVatFormatValidator\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"rocketfellows\\GRVatFormatValidator\\tests\\": "tests/"
}
}
}
Loading

0 comments on commit 7c9f257

Please sign in to comment.