Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Austrian insurance number and readme #84

Merged
merged 5 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Or add your custom messages directly to the validator like [described in the doc

The following validation rules are available with this package.

### Austrian insurance Number (austrian social security number)

The field under validation must be an [Austrian insurance number](https://de.wikipedia.org/wiki/Sozialversicherungsnummer#%C3%96sterreich)

public Intervention\Validation\Rules\AustrianInsuranceNumber::__construct()

### Base64 encoded string

The field under validation must be [Base64 encoded](https://en.wikipedia.org/wiki/Base64).
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/AustrianInsuranceNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AustrianInsuranceNumber extends AbstractRule
*/
public function isValid(mixed $value): bool
{
$value = str_replace(' ', '', strval($value));
$value = str_replace(' ', '', (string) $value);

return is_numeric($value)
&& $this->startsNotWithZero($value)
Expand Down Expand Up @@ -62,7 +62,7 @@ private function checkChecksum(string $svnumber): bool

$sum = 0;
for ($c = 0, $cMax = strlen($svnumberWithoutChecksum); $c < $cMax; $c++) {
$result = intval($svnumberWithoutChecksum[$c]) * $this->multiplierSeries[$c];
$result = (int) $svnumberWithoutChecksum[$c] * $this->multiplierSeries[$c];
$sum += $result;
}
$checksum = $sum % 11;
Expand Down
1 change: 1 addition & 0 deletions src/lang/es/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
'gtin' => ':attribute no es un número GTIN válido.',
'postalcode' => 'El valor de :attribute debe ser un código postal válido.',
'mimetype' => 'El valor de :attribute no contiene un tipo de media de internet (MIME-Type) válido.',
'austrianinsurancenumber' => 'El valor de :attribute contiene un número de seguro austriaco válido.',
'grid' => 'El valor de :attribute no contiene un Global Release Identifier (GRid) válido.',
'hslcolor' => ':attribute no es un valor de color HSL válido.',
'hsvcolor' => ':attribute no es un valor de color HSV válido.',
Expand Down
1 change: 1 addition & 0 deletions src/lang/fr/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
'gtin' => 'Le :attribute doit être un GTIN valide.',
'postalcode' => 'La valeur :attribute doit être un code postal valide.',
'mimetype' => 'La valeur :attribute ne contient pas de type de média Internet valide (type MIME).',
'austrianinsurancenumber' => 'La valeur :attribute ne contient pas de numéro d\'assurance autrichien valide.',
'grid' => 'Le :attribute doit être un Global Release Identifier (GRid) valide.',
'hslcolor' => ':attribute n\'est pas une valeur de couleur HSL valide',
'hsvcolor' => ':attribute n\'est pas une valeur de couleur HSV valide',
Expand Down
1 change: 1 addition & 0 deletions src/lang/nl/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
'gtin' => ':attribute is geen geldig Global Trade Item Number (GTIN).',
'postalcode' => ':attribute moet een geldige postcode zijn.',
'mimetype' => ':attribute bevat geen geldig internetmediatype (MIME-type).',
'austrianinsurancenumber' => 'De waarde :attribute bevat geen geldig Oostenrijks verzekeringsnummer.',
'grid' => ':attribute moet een geldige Global Release Identifier (GRid) zijn.',
'hslcolor' => ':attribute is geen geldige HSL-kleurwaarde',
'hsvcolor' => ':attribute is geen geldige HSV-kleurwaarde',
Expand Down
Loading