format('ymd'); if ($gender && $gender == static::GENDER_MALE) { $randomDigits = (string)static::numerify('##') . static::randomElement(array(1,3,5,7,9)); } elseif ($gender && $gender == static::GENDER_FEMALE) { $randomDigits = (string)static::numerify('##') . static::randomElement(array(0,2,4,6,8)); } else { $randomDigits = (string)static::numerify('###'); } $checksum = Luhn::computeCheckDigit($datePart . $randomDigits); return $datePart . '-' . $randomDigits . $checksum; } }