Skip to content

Commit

Permalink
Updated Austrian insurance number and readme (#84)
Browse files Browse the repository at this point in the history
* Added validation rule for austrian insurance numbers to readme
* Fixed typo in translation
* Type casting, translations and readme
  • Loading branch information
lkrempler authored May 30, 2024
1 parent af8a987 commit 1b73105
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
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

0 comments on commit 1b73105

Please sign in to comment.