forked from Respect/Validation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove "IdentityCard" in favor of "PolishIdCard"
The only Identity Card we have is the Polish one, that said it makes more sense to have a specific rule that only validates that, rather than having a "IdentityCard" rule that only accepts one value. Signed-off-by: Henrique Moody <[email protected]>
- Loading branch information
1 parent
f23b3a5
commit c522f62
Showing
15 changed files
with
58 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# PolishIdCard | ||
|
||
- `PolishIdCard()` | ||
|
||
Validates whether the input is a Polish identity card (Dowód Osobisty). | ||
|
||
```php | ||
v::polishIdCard()->validate('AYW036733'); // true | ||
v::polishIdCard()->validate('APH505567'); // true | ||
v::polishIdCard()->validate('APH 505567'); // false | ||
v::polishIdCard()->validate('AYW036731'); // false | ||
``` | ||
|
||
## Categorization | ||
|
||
- Identifications | ||
|
||
## Changelog | ||
|
||
Version | Description | ||
--------|------------- | ||
2.0.0 | Created | ||
|
||
*** | ||
See also: | ||
|
||
- [Nip](Nip.md) | ||
- [Pesel](Pesel.md) | ||
- [SubdivisionCode](SubdivisionCode.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,12 @@ | |
|
||
declare(strict_types=1); | ||
|
||
namespace Respect\Validation\Exceptions\Locale; | ||
|
||
use Respect\Validation\Exceptions\ValidationException; | ||
namespace Respect\Validation\Exceptions; | ||
|
||
/** | ||
* @author Henrique Moody <[email protected]> | ||
*/ | ||
final class PlIdentityCardException extends ValidationException | ||
final class PolishIdCardException extends ValidationException | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,20 +11,19 @@ | |
|
||
declare(strict_types=1); | ||
|
||
namespace Respect\Validation\Rules\Locale; | ||
namespace Respect\Validation\Rules; | ||
|
||
use Respect\Validation\Rules\AbstractRule; | ||
use function ord; | ||
use function preg_match; | ||
|
||
/** | ||
* Validator for Polish identity card. | ||
* Validates whether the input is a Polish identity card (Dowód Osobisty). | ||
* | ||
* @see https://en.wikipedia.org/wiki/Polish_identity_card | ||
* | ||
* @author Henrique Moody <[email protected]> | ||
*/ | ||
final class PlIdentityCard extends AbstractRule | ||
final class PolishIdCard extends AbstractRule | ||
{ | ||
private const ASCII_CODE_0 = 48; | ||
private const ASCII_CODE_7 = 55; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.