Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1450 from vadimonus/kz_iin_fix
Browse files Browse the repository at this point in the history
Fixing rare iin with 13-digits.
  • Loading branch information
fzaninotto authored Mar 15, 2018
2 parents 68c7e19 + 5ff864f commit 65fbcca
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Faker/Provider/kk_KZ/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,17 @@ public static function individualIdentificationNumber(\DateTime $birthDate = nul
$birthDate = DateTime::dateTimeBetween();
}

$population = mt_rand(1000, 2000);
$century = self::getCenturyByYear((int) $birthDate->format('Y'));
do {
$population = mt_rand(1000, 2000);
$century = self::getCenturyByYear((int) $birthDate->format('Y'));

$iin = $birthDate->format('ymd');
$iin .= (string) self::$genderCenturyMap[$gender][$century];
$iin .= (string) $population;
$iin = $birthDate->format('ymd');
$iin .= (string) self::$genderCenturyMap[$gender][$century];
$iin .= (string) $population;
$checksum = self::checkSum($iin);
} while ($checksum === 10);

return $iin . (string) self::checkSum($iin);
return $iin . (string) $checksum;
}

/**
Expand Down

0 comments on commit 65fbcca

Please sign in to comment.