Zend\Validator\CreditCard
Synopsis
class CreditCard
extends AbstractValidator
{
- // constants
- 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';
- // members
- protected array $messageTemplates;
- protected array $cardName;
- protected array $cardLength;
- protected array $cardType;
- protected array $options;
- // Inherited members from AbstractValidator
- protected mixed $value;
- protected TranslatorInterface $defaultTranslator;
- protected string $defaultTranslatorTextDomain;
- protected integer $messageLength;
- protected array $abstractOptions;
- // methods
- public void __construct()
- public array getType()
- public CreditCard setType()
- public CreditCard addType()
- public callable getService()
- public CreditCard setService()
- public bool isValid()
- // Inherited methods from AbstractValidator
- public void __construct()
- public mixed getOption()
- public array getOptions()
- public AbstractValidator setOptions()
- public array getMessages()
- public bool __invoke()
- public array getMessageVariables()
- public array getMessageTemplates()
- public AbstractValidator setMessage()
- public AbstractValidator setMessages()
- public mixed __get()
- protected string createMessage()
- protected void error()
- protected mixed getValue()
- protected void setValue()
- public AbstractValidator setValueObscured()
- public bool isValueObscured()
- public AbstractValidator setTranslator()
- public TranslatorInterface|null getTranslator()
- public bool hasTranslator()
- public AbstractValidator setTranslatorTextDomain()
- public string getTranslatorTextDomain()
- public static void setDefaultTranslator()
- public static TranslatorInterface|null getDefaultTranslator()
- public static bool hasDefaultTranslator()
- public static void setDefaultTranslatorTextDomain()
- public static string getDefaultTranslatorTextDomain()
- public AbstractValidator setTranslatorEnabled()
- public bool isTranslatorEnabled()
- public static int getMessageLength()
- public static void setMessageLength()
- protected string translateMessage()
Hierarchy
Extends
Constants
Name | Value |
---|---|
ALL | 'All' |
AMERICAN_EXPRESS | 'American_Express' |
UNIONPAY | 'Unionpay' |
DINERS_CLUB | 'Diners_Club' |
DINERS_CLUB_US | 'Diners_Club_US' |
DISCOVER | 'Discover' |
JCB | 'JCB' |
LASER | 'Laser' |
MAESTRO | 'Maestro' |
MASTERCARD | 'Mastercard' |
SOLO | 'Solo' |
VISA | 'Visa' |
CHECKSUM | 'creditcardChecksum' |
CONTENT | 'creditcardContent' |
INVALID | 'creditcardInvalid' |
LENGTH | 'creditcardLength' |
PREFIX | 'creditcardPrefix' |
SERVICE | 'creditcardService' |
SERVICEFAILURE | 'creditcardServiceFailure' |
Members
protected
- $abstractOptions
- $cardLength
—
array
List of allowed CCV lengths - $cardName
—
array
List of CCV names - $cardType
—
array
List of accepted CCV provider tags - $defaultTranslator
—
Zend\Validator\Translator\TranslatorInterface
Default translation object for all validate objects - $defaultTranslatorTextDomain
—
string
Default text domain to be used with translator - $messageLength
—
int
Limits the maximum returned length of an error message - $messageTemplates
—
array
Validation failure message template definitions - $options
—
array
Options for this validator - $value
—
mixed
The value to be validated
Methods
public
- __construct() — Constructor
- addType() — Adds a CCI to be accepted by validation
- getService() — Returns the actual set service
- getType() — Returns a list of accepted CCIs
- isValid() — Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum)
- setService() — Sets a new callback for service validation
- setType() — Sets CCIs which are accepted by validation
Inherited from Zend\Validator\AbstractValidator
protected
- createMessage() — Constructs and returns a validation failure message with the given message key and value.
- error()
- getValue() — Returns the validation value
- setValue() — Sets the value to be validated and clears the messages and errors arrays
- translateMessage() — Translate a validation message
public
- __get() — Magic function returns the value of the requested property, if and only if it is the value or a message variable.
- __invoke() — Invoke as command
- getDefaultTranslator() — Get default translation object for all validate objects
- getDefaultTranslatorTextDomain() — Get default translation text domain for all validate objects
- getMessageLength() — Returns the maximum allowed message length
- getMessageTemplates() — Returns the message templates from the validator
- getMessageVariables() — Returns an array of the names of variables that are used in constructing validation failure messages
- getMessages() — Returns array of validation failure messages
- getOption() — Returns an option
- getOptions() — Returns all available options
- getTranslator() — Return translation object
- getTranslatorTextDomain() — Return the translation text domain
- hasDefaultTranslator() — Is there a default translation object set?
- hasTranslator() — Does this validator have its own specific translator?
- isTranslatorEnabled() — Is translation enabled?
- isValueObscured() — Retrieve flag indicating whether or not value should be obfuscated in messages
- setDefaultTranslator() — Set default translation object for all validate objects
- setDefaultTranslatorTextDomain() — Set default translation text domain for all validate objects
- setMessage() — Sets the validation failure message template for a particular key
- setMessageLength() — Sets the maximum allowed message length
- setMessages() — 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.
- setOptions() — Sets one or multiple options
- setTranslator() — Set translation object
- setTranslatorEnabled() — Indicate whether or not translation should be enabled
- setTranslatorTextDomain() — Set translation text domain
- setValueObscured() — Set flag indicating whether or not value should be obfuscated in messages