public static generateLuhnNumber ( $partialValue ) : string | ||
return | string |
public static function generateLuhnNumber($partialValue)
{
if (!preg_match('/^\\d+$/', $partialValue)) {
throw new InvalidArgumentException('Argument should be an integer.');
}
return $partialValue . Luhn::computeCheckDigit($partialValue);
}
/** * @expectedException InvalidArgumentException * @expectedExceptionMessage Argument should be an integer. */ public function testGenerateLuhnNumberWithInvalidPrefix() { Luhn::generateLuhnNumber('abc'); }