芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Person.php
generator->parse(static::randomElement(static::$lastNameFormat)); } /** * Return male last name * * @return string * * @example 'Vasiliauskas' */ public function lastNameMale() { return static::randomElement(static::$lastNameMale); } /** * Return female last name * * @return string * * @example 'Žukauskaitė' */ public function lastNameFemale() { return static::randomElement(static::$lastNameFemale); } /** * Return driver license number * * @return string * * @example 12345678 */ public function driverLicence() { return $this->bothify('########'); } /** * Return passport number * * @return string * * @example 12345678 */ public function passportNumber() { return $this->bothify('########'); } /** * National Personal Identity number (asmens kodas) * * @see https://en.wikipedia.org/wiki/National_identification_number#Lithuania * @see https://lt.wikipedia.org/wiki/Asmens_kodas * * @param string $gender [male|female] * @param \DateTime $birthdate * @param string $randomNumber three integers * * @return string on format XXXXXXXXXXX */ public function personalIdentityNumber($gender = 'male', \DateTime $birthdate = null, $randomNumber = '') { if (!$birthdate) { $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); } $genderNumber = ($gender == 'male') ? 1 : 0; $firstNumber = (int) floor($birthdate->format('Y') / 100) * 2 - 34 - $genderNumber; $datePart = $birthdate->format('ymd'); $randomDigits = (string) (!$randomNumber || strlen($randomNumber) < 3) ? static::numerify('###') : substr($randomNumber, 0, 3); $partOfPerosnalCode = $firstNumber . $datePart . $randomDigits; $sum = self::calculateSum($partOfPerosnalCode, 1); $liekana = $sum % 11; if ($liekana !== 10) { $lastNumber = $liekana; return $firstNumber . $datePart . $randomDigits . $lastNumber; } $sum = self::calculateSum($partOfPerosnalCode, 2); $liekana = $sum % 11; $lastNumber = ($liekana !== 10) ? $liekana : 0; return $firstNumber . $datePart . $randomDigits . $lastNumber; } /** * Calculate the sum of personal code * * @see https://en.wikipedia.org/wiki/National_identification_number#Lithuania * @see https://lt.wikipedia.org/wiki/Asmens_kodas * * @param string $numbers * @param int $time [1|2] * * @return int */ private static function calculateSum($numbers, $time = 1) { if ($time == 1) { $multipliers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]; } else { $multipliers = [3, 4, 5, 6, 7, 8, 9, 1, 2, 3]; } $sum = 0; for ($i = 1; $i <= 10; ++$i) { $sum += ((int) $numbers[$i - 1]) * $multipliers[$i - 1]; } return (int) $sum; } }