Definition at line 33 of file Ccnum.php.
◆ __construct()
Definition at line 62 of file Ccnum.php.
64 trigger_error(
'Using the Ccnum validator is deprecated in favor of the CreditCard validator');
◆ isValid()
Defined by Zend_Validate_Interface
Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum)
- Parameters
-
- Returns
- boolean
- See also
- Zend_Filter_Digits
Implements Zend_Validate_Interface.
Definition at line 75 of file Ccnum.php.
79 if (
null === self::$_filter) {
83 #require_once 'Zend/Filter/Digits.php'; 87 $valueFiltered = self::$_filter->filter(
$value);
89 $length = strlen($valueFiltered);
91 if ($length < 13 || $length > 19) {
92 $this->
_error(self::LENGTH);
99 for (
$i = $length - 2;
$i >= 0;
$i--) {
100 $digit = $weight * $valueFiltered[
$i];
101 $sum += floor($digit / 10) + $digit % 10;
102 $weight = $weight % 2 + 1;
105 if ((10 - $sum % 10) % 10 != $valueFiltered[$length - 1]) {
106 $this->
_error(self::CHECKSUM, $valueFiltered);
_error($messageKey, $value=null)
◆ $_filter
◆ $_messageTemplates
Initial value:= array(
self::LENGTH => "'%value%' must contain between 13 and 19 digits",
self::CHECKSUM => "Luhn algorithm (mod-10 checksum) failed on '%value%'"
)
Definition at line 57 of file Ccnum.php.
◆ CHECKSUM
const CHECKSUM = 'ccnumChecksum' |
Validation failure message key for when the value fails the mod-10 checksum
Definition at line 43 of file Ccnum.php.
◆ LENGTH
const LENGTH = 'ccnumLength' |
Validation failure message key for when the value is not of valid length
Definition at line 38 of file Ccnum.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Validate/Ccnum.php