format('dmy'); /** * @todo These number should be random based on birth year * @link http://no.wikipedia.org/wiki/F%C3%B8dselsnummer */ $randomDigits = (string)static::numerify('##'); switch($gender) { case static::GENDER_MALE: $genderDigit = static::randomElement(array(1,3,5,7,9)); break; case static::GENDER_FEMALE: $genderDigit = static::randomElement(array(0,2,4,6,8)); break; default: $genderDigit = (string)static::numerify('#'); } $digits = $datePart.$randomDigits.$genderDigit; /** * @todo Calculate modulo 11 of $digits * @link http://no.wikipedia.org/wiki/F%C3%B8dselsnummer */ $checksum = (string)static::numerify('##'); return $digits.$checksum; } }