Skip to content

Commit

Permalink
Merge pull request #1 from rocketfellows/CVFV-19
Browse files Browse the repository at this point in the history
  • Loading branch information
arslanim committed Apr 4, 2023
2 parents 0b64c4d + f911241 commit 81379cd
Show file tree
Hide file tree
Showing 9 changed files with 1,803 additions and 99 deletions.
54 changes: 18 additions & 36 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
# Slovenia vat format validator

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

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

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

Expand All @@ -36,17 +11,17 @@ 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/si-vat-format-validator
```

## Usage example

Valid <Country> vat number:
Valid Slovenia vat number:

```php
$validator = new <Country>VatFormatValidator();
$validator->isValid('');
$validator->isValid('');
$validator = new SIVatFormatValidator();
$validator->isValid('SI12345678');
$validator->isValid('12345678');
```

Returns:
Expand All @@ -56,22 +31,29 @@ true
true
```

Invalid <Country> vat number:
Invalid Slovenia vat number:

```php
$validator = new <Country>VatFormatValidator();
$validator->isValid('');
$validator = new SIVatFormatValidator();
$validator->isValid('SI123456789');
$validator->isValid('SI1234567');
$validator->isValid('DE12345678');
$validator->isValid('123456789');
$validator->isValid('1234567');
$validator->isValid('');
```

```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="1680628708">
<project timestamp="1680628708">
<file name="/app/src/SIVatFormatValidator.php">
<class name="rocketfellows\SIVatFormatValidator\SIVatFormatValidator" 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="18"/>
<line num="13" type="stmt" count="18"/>
<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/si-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\\SIVatFormatValidator\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"rocketfellows\\SIVatFormatValidator\\tests\\": "tests/"
}
}
}
Loading

0 comments on commit 81379cd

Please sign in to comment.