25 #require_once 'Zend/Validate/Abstract.php'; 67 self::CHECKSUM =>
"'%value%' seems to contain an invalid checksum",
68 self::CONTENT =>
"'%value%' must contain only digits",
69 self::INVALID =>
"Invalid type given. String expected",
70 self::LENGTH =>
"'%value%' contains an invalid amount of digits",
71 self::PREFIX =>
"'%value%' is not from an allowed institute",
72 self::SERVICE =>
"'%value%' seems to be an invalid creditcard number",
73 self::SERVICEFAILURE =>
"An exception has been raised while validating '%value%'",
82 self::AMERICAN_EXPRESS => array(15),
83 self::DINERS_CLUB => array(14),
84 self::DINERS_CLUB_US => array(16),
85 self::DISCOVER => array(16),
86 self::JCB => array(16),
87 self::LASER => array(16, 17, 18, 19),
88 self::MAESTRO => array(12, 13, 14, 15, 16, 17, 18, 19),
89 self::MASTERCARD => array(16),
90 self::SOLO => array(16, 18, 19),
91 self::UNIONPAY => array(16, 17, 18, 19),
92 self::VISA => array(16),
101 self::AMERICAN_EXPRESS => array(
'34',
'37'),
102 self::DINERS_CLUB => array(
'300',
'301',
'302',
'303',
'304',
'305',
'36'),
103 self::DINERS_CLUB_US => array(
'54',
'55'),
104 self::DISCOVER => array(
'6011',
'622126',
'622127',
'622128',
'622129',
'62213',
105 '62214',
'62215',
'62216',
'62217',
'62218',
'62219',
106 '6222',
'6223',
'6224',
'6225',
'6226',
'6227',
'6228',
107 '62290',
'62291',
'622920',
'622921',
'622922',
'622923',
108 '622924',
'622925',
'644',
'645',
'646',
'647',
'648',
110 self::JCB => array(
'3528',
'3529',
'353',
'354',
'355',
'356',
'357',
'358'),
111 self::LASER => array(
'6304',
'6706',
'6771',
'6709'),
112 self::MAESTRO => array(
'5018',
'5020',
'5038',
'6304',
'6759',
'6761',
'6763'),
113 self::MASTERCARD => array(
'51',
'52',
'53',
'54',
'55'),
114 self::SOLO => array(
'6334',
'6767'),
115 self::UNIONPAY => array(
'622126',
'622127',
'622128',
'622129',
'62213',
'62214',
116 '62215',
'62216',
'62217',
'62218',
'62219',
'6222',
'6223',
117 '6224',
'6225',
'6226',
'6227',
'6228',
'62290',
'62291',
118 '622920',
'622921',
'622922',
'622923',
'622924',
'622925'),
119 self::VISA => array(
'4'),
147 $temp[
'type'] = array_shift(
$options);
149 $temp[
'service'] = array_shift(
$options);
155 if (!array_key_exists(
'type',
$options)) {
160 if (array_key_exists(
'service',
$options)) {
183 $this->_type = array();
195 if (is_string(
$type)) {
199 foreach(
$type as $typ) {
200 if (defined(
'self::' . strtoupper($typ)) && !in_array($typ, $this->_type)) {
201 $this->_type[] = $typ;
204 if (($typ == self::ALL)) {
205 $this->_type = array_keys($this->_cardLength);
232 #require_once 'Zend/Validate/Exception.php'; 257 if (!ctype_digit(
$value)) {
266 foreach ($types as
$type) {
270 if (in_array($length, $this->_cardLength[
$type])) {
278 if ($foundp ==
false){
283 if ($foundl ==
false) {
291 for (
$i = $length - 2;
$i >= 0;
$i--) {
293 $sum += floor($digit / 10) + $digit % 10;
294 $weight = $weight % 2 + 1;
297 if ((10 - $sum % 10) % 10 !=
$value[$length - 1]) {
302 if (!empty($this->_service)) {
304 #require_once 'Zend/Validate/Callback.php'; 306 $callback->setOptions($this->_type);
307 if (!$callback->isValid(
$value)) {
_error($messageKey, $value=null)
__construct($options=array())