PHP Class Faker\Calculator\Luhn

Luhn algorithm is used to validate credit card numbers, IMEI numbers, and National Provider Identifier numbers.
See also: http://en.wikipedia.org/wiki/Luhn_algorithm
Mostrar archivo Open project: fzaninotto/faker Class Usage Examples

Public Methods

Method Description
computeCheckDigit ( $partialNumber ) : string
generateLuhnNumber ( $partialValue ) : string Generate a Luhn compliant number.
isValid ( string $number ) : boolean Checks whether a number (partial number + check digit) is Luhn compliant

Private Methods

Method Description
checksum ( string $number ) : integer

Method Details

computeCheckDigit() public static method

public static computeCheckDigit ( $partialNumber ) : string
$partialNumber
return string

generateLuhnNumber() public static method

Generate a Luhn compliant number.
public static generateLuhnNumber ( $partialValue ) : string
return string

isValid() public static method

Checks whether a number (partial number + check digit) is Luhn compliant
public static isValid ( string $number ) : boolean
$number string
return boolean