芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Person.php
generator->parse(static::randomElement(static::$lastNameFormat)); } public static function lastNameMale() { return static::randomElement(static::$lastNameMale); } public static function lastNameFemale() { return static::randomElement(static::$lastNameFemale); } public function title($gender = null) { return static::randomElement(static::$title); } /** * replaced by specific unisex Polish title */ public static function titleMale() { return static::randomElement(static::$title); } /** * replaced by specific unisex Polish title */ public static function titleFemale() { return static::randomElement(static::$title); } /** * PESEL - Universal Electronic System for Registration of the Population * * @see http://en.wikipedia.org/wiki/PESEL * * @param DateTime $birthdate * @param string $sex M for male or F for female * * @return string 11 digit number, like 44051401358 */ public static function pesel($birthdate = null, $sex = null) { if ($birthdate === null) { $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); } $weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]; $length = count($weights); $fullYear = (int) $birthdate->format('Y'); $year = (int) $birthdate->format('y'); $month = $birthdate->format('m') + (((int) ($fullYear / 100) - 14) % 5) * 20; $day = $birthdate->format('d'); $result = [(int) ($year / 10), $year % 10, (int) ($month / 10), $month % 10, (int) ($day / 10), $day % 10]; for ($i = 6; $i < $length; ++$i) { $result[$i] = static::randomDigit(); } $result[$length - 1] |= 1; if ($sex == 'F') { $result[$length - 1] -= 1; } $checksum = 0; for ($i = 0; $i < $length; ++$i) { $checksum += $weights[$i] * $result[$i]; } $checksum = (10 - ($checksum % 10)) % 10; $result[] = $checksum; return implode('', $result); } /** * National Identity Card number * * @see http://en.wikipedia.org/wiki/Polish_National_Identity_Card * * @return string 3 letters and 6 digits, like ABA300000 */ public static function personalIdentityNumber() { $range = str_split('ABCDEFGHIJKLMNPRSTUVWXYZ'); $low = ['A', static::randomElement($range), static::randomElement($range)]; $high = [static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit()]; $weights = [7, 3, 1, 7, 3, 1, 7, 3]; $checksum = 0; for ($i = 0, $size = count($low); $i < $size; ++$i) { $checksum += $weights[$i] * (ord($low[$i]) - 55); } for ($i = 0, $size = count($high); $i < $size; ++$i) { $checksum += $weights[$i + 3] * $high[$i]; } $checksum %= 10; return implode('', $low) . $checksum . implode('', $high); } /** * Taxpayer Identification Number (NIP in Polish) * * @see http://en.wikipedia.org/wiki/PESEL#Other_identifiers * @see http://pl.wikipedia.org/wiki/NIP * * @return string 10 digit number */ public static function taxpayerIdentificationNumber() { $weights = [6, 5, 7, 2, 3, 4, 5, 6, 7]; $result = []; do { $result = [ static::randomDigitNotNull(), static::randomDigitNotNull(), static::randomDigitNotNull(), static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit(), ]; $checksum = 0; for ($i = 0, $size = count($result); $i < $size; ++$i) { $checksum += $weights[$i] * $result[$i]; } $checksum %= 11; } while ($checksum == 10); $result[] = $checksum; return implode('', $result); } }