Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkingshott authored and actions-user committed Mar 25, 2021
1 parent 6b6ac3d commit c96c97f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Rules/CitizenIdentification.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@ protected function verifyBrazil($value) : bool
**/
protected function verifyVietnam($value) : bool
{
$state = '0\d{2}'; // state code
$century = ceil(date('Y') / 100); // current century
$state = '0\d{2}'; // state code
$century = ceil(date('Y') / 100); // current century
$minNumGender = 0; //century: 20, male: 0, female: 1
// 20: begin century
$maxNumGender = 1 + ($century - 20) * 2; //ex: century: 21, male: 2, female: 3. max: century: 25, male: 8, female: 9
$numBirth = '\d{2}'; // last 2 number of birth year
$numRand = '\d{6}'; // 6 random number
$numBirth = '\d{2}'; // last 2 number of birth year
$numRand = '\d{6}'; // 6 random number

return preg_match('/^'.$state.'['.$minNumGender.'-'.$maxNumGender.']'.$numBirth.$numRand.'$/', $value) > 0;
}
}

0 comments on commit c96c97f

Please sign in to comment.