%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/water/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); } }