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
Afficher le fichier Open project: fzaninotto/faker Class Usage Examples

Méthodes publiques

Méthode 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

Méthode Description
checksum ( string $number ) : integer

Method Details

computeCheckDigit() public static méthode

public static computeCheckDigit ( $partialNumber ) : string
$partialNumber
Résultat string

generateLuhnNumber() public static méthode

Generate a Luhn compliant number.
public static generateLuhnNumber ( $partialValue ) : string
Résultat string

isValid() public static méthode

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