Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Zend_Validate_CreditCard Class Reference

Public Member Functions

 __construct ($options=array())
 Constructor.
 
 getType ()
 Returns a list of accepted CCIs.
 
 setType ($type)
 Sets CCIs which are accepted by validation.
 
 addType ($type)
 Adds a CCI to be accepted by validation.
 
 getService ()
 Returns the actual set service.
 
 setService ($service)
 Sets a new callback for service validation.
 
 isValid ($value)
 Defined by Zend_Validate_Interface.
 
- Public Member Functions inherited from Zend_Validate_Abstract
 getMessages ()
 Returns array of validation failure messages.
 
 getMessageVariables ()
 Returns an array of the names of variables that are used in constructing validation failure messages.
 
 getMessageTemplates ()
 Returns the message templates from the validator.
 
 setMessage ($messageString, $messageKey=null)
 Sets the validation failure message template for a particular key.
 
 setMessages (array $messages)
 Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings.
 
 __get ($property)
 Magic function returns the value of the requested property, if and only if it is the value or a message variable.
 
 getErrors ()
 Returns array of validation failure message codes.
 
 setObscureValue ($flag)
 Set flag indicating whether or not value should be obfuscated in messages.
 
 getObscureValue ()
 Retrieve flag indicating whether or not value should be obfuscated in messages.
 
 setTranslator ($translator=null)
 Set translation object.
 
 getTranslator ()
 Return translation object.
 
 hasTranslator ()
 Does this validator have its own specific translator?
 
 setDisableTranslator ($flag)
 Indicate whether or not translation should be disabled.
 
 translatorIsDisabled ()
 Is translation disabled?
 

Public Attributes

const ALL = 'All'
 
const AMERICAN_EXPRESS = 'American_Express'
 
const UNIONPAY = 'Unionpay'
 
const DINERS_CLUB = 'Diners_Club'
 
const DINERS_CLUB_US = 'Diners_Club_US'
 
const DISCOVER = 'Discover'
 
const JCB = 'JCB'
 
const LASER = 'Laser'
 
const MAESTRO = 'Maestro'
 
const MASTERCARD = 'Mastercard'
 
const SOLO = 'Solo'
 
const VISA = 'Visa'
 
const CHECKSUM = 'creditcardChecksum'
 
const CONTENT = 'creditcardContent'
 
const INVALID = 'creditcardInvalid'
 
const LENGTH = 'creditcardLength'
 
const PREFIX = 'creditcardPrefix'
 
const SERVICE = 'creditcardService'
 
const SERVICEFAILURE = 'creditcardServiceFailure'
 

Protected Attributes

 $_messageTemplates
 
 $_cardLength
 
 $_cardType
 
 $_type = array()
 
 $_service
 
- Protected Attributes inherited from Zend_Validate_Abstract
 $_value
 
 $_messageVariables = array()
 
 $_messageTemplates = array()
 
 $_messages = array()
 
 $_obscureValue = false
 
 $_errors = array()
 
 $_translator
 
 $_translatorDisabled = false
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Validate_Abstract
static setDefaultTranslator ($translator=null)
 Set default translation object for all validate objects.
 
static getDefaultTranslator ()
 Get default translation object for all validate objects.
 
static hasDefaultTranslator ()
 Is there a default translation object set?
 
static getMessageLength ()
 Returns the maximum allowed message length.
 
static setMessageLength ($length=-1)
 Sets the maximum allowed message length.
 
- Protected Member Functions inherited from Zend_Validate_Abstract
 _createMessage ($messageKey, $value)
 Constructs and returns a validation failure message with the given message key and value.
 
 _error ($messageKey, $value=null)
 
 _setValue ($value)
 Sets the value to be validated and clears the messages and errors arrays.
 
- Static Protected Attributes inherited from Zend_Validate_Abstract
static $_defaultTranslator
 
static $_messageLength = -1
 

Constructor & Destructor Documentation

__construct (   $options = array())

Constructor.

Parameters
string | array$typeOPTIONAL Type of CCI to allow

Member Function Documentation

addType (   $type)

Adds a CCI to be accepted by validation.

Parameters
string | array$typeType to allow for validation
Returns
Zend_Validate_CreditCard Provides a fluid interface
getService ( )

Returns the actual set service.

Returns
callback
getType ( )

Returns a list of accepted CCIs.

Returns
array
isValid (   $value)

Defined by Zend_Validate_Interface.

Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum)

Parameters
string$value
Returns
boolean

Implements Zend_Validate_Interface.

setService (   $service)

Sets a new callback for service validation.

Parameters
unknown_type$service
setType (   $type)

Sets CCIs which are accepted by validation.

Parameters
string | array$typeType to allow for validation
Returns
Zend_Validate_CreditCard Provides a fluid interface

Member Data Documentation

$_cardLength
protected
Initial value:
= array(
self::AMERICAN_EXPRESS => array(15),
self::DINERS_CLUB => array(14),
self::DINERS_CLUB_US => array(16),
self::DISCOVER => array(16),
self::JCB => array(16),
self::LASER => array(16, 17, 18, 19),
self::MAESTRO => array(12, 13, 14, 15, 16, 17, 18, 19),
self::MASTERCARD => array(16),
self::SOLO => array(16, 18, 19),
self::UNIONPAY => array(16, 17, 18, 19),
self::VISA => array(16),
)
$_cardType
protected
Initial value:
= array(
self::AMERICAN_EXPRESS => array('34', '37'),
self::DINERS_CLUB => array('300', '301', '302', '303', '304', '305', '36'),
self::DINERS_CLUB_US => array('54', '55'),
self::DISCOVER => array('6011', '622126', '622127', '622128', '622129', '62213',
'62214', '62215', '62216', '62217', '62218', '62219',
'6222', '6223', '6224', '6225', '6226', '6227', '6228',
'62290', '62291', '622920', '622921', '622922', '622923',
'622924', '622925', '644', '645', '646', '647', '648',
'649', '65'),
self::JCB => array('3528', '3529', '353', '354', '355', '356', '357', '358'),
self::LASER => array('6304', '6706', '6771', '6709'),
self::MAESTRO => array('5018', '5020', '5038', '6304', '6759', '6761', '6763'),
self::MASTERCARD => array('51', '52', '53', '54', '55'),
self::SOLO => array('6334', '6767'),
self::UNIONPAY => array('622126', '622127', '622128', '622129', '62213', '62214',
'62215', '62216', '62217', '62218', '62219', '6222', '6223',
'6224', '6225', '6226', '6227', '6228', '62290', '62291',
'622920', '622921', '622922', '622923', '622924', '622925'),
self::VISA => array('4'),
)
$_messageTemplates
protected
Initial value:
= array(
self::CHECKSUM => "'%value%' seems to contain an invalid checksum",
self::CONTENT => "'%value%' must contain only digits",
self::INVALID => "Invalid type given. String expected",
self::LENGTH => "'%value%' contains an invalid amount of digits",
self::PREFIX => "'%value%' is not from an allowed institute",
self::SERVICE => "'%value%' seems to be an invalid creditcard number",
self::SERVICEFAILURE => "An exception has been raised while validating '%value%'",
)
$_service
protected
$_type = array()
protected
const ALL = 'All'
const AMERICAN_EXPRESS = 'American_Express'
const CHECKSUM = 'creditcardChecksum'
const CONTENT = 'creditcardContent'
const DINERS_CLUB = 'Diners_Club'
const DINERS_CLUB_US = 'Diners_Club_US'
const DISCOVER = 'Discover'
const INVALID = 'creditcardInvalid'
const JCB = 'JCB'
const LASER = 'Laser'
const LENGTH = 'creditcardLength'
const MAESTRO = 'Maestro'
const MASTERCARD = 'Mastercard'
const PREFIX = 'creditcardPrefix'
const SERVICE = 'creditcardService'
const SERVICEFAILURE = 'creditcardServiceFailure'
const SOLO = 'Solo'
const UNIONPAY = 'Unionpay'
const VISA = 'Visa'