ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 3.147.43.145 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/funds/vendor/fzaninotto/faker/src/Faker/Calculator/ |
Upload File : |
<?php namespace Faker\Calculator; use InvalidArgumentException; class TCNo { /** * Generates Turkish Identity Number Checksum * Gets first 9 digit as prefix and calcuates checksums * * https://en.wikipedia.org/wiki/Turkish_Identification_Number * * @param string $identityPrefix * @return string Checksum (two digit) */ public static function checksum($identityPrefix) { if (strlen((string)$identityPrefix) !== 9) { throw new InvalidArgumentException('Argument should be an integer and should be 9 digits.'); } $oddSum = 0; $evenSum = 0; $identityArray = array_map('intval', str_split($identityPrefix)); // Creates array from int foreach ($identityArray as $index => $digit) { if ($index % 2 == 0) { $evenSum += $digit; } else { $oddSum += $digit; } } $tenthDigit = (7 * $evenSum - $oddSum) % 10; $eleventhDigit = ($evenSum + $oddSum + $tenthDigit) % 10; return $tenthDigit . $eleventhDigit; } /** * Checks whether an TCNo has a valid checksum * * @param string $tcNo * @return boolean */ public static function isValid($tcNo) { return self::checksum(substr($tcNo, 0, -2)) === substr($tcNo, -2, 2); } }