package Default
inherited_from \Zend\Validator\AbstractValidator

 Methods

Constructor

__construct(string|array|\Traversable $options = array()
inherited_from \Zend\Validator\AbstractValidator::__construct()

Parameters

$options

stringarray\Traversable

OPTIONAL Type of CCI to allow

Abstract constructor for all validators A validator should accept following parameters: - nothing f.e. Validator() - one or multiple scalar values f.e. Validator($first, $second, $third) - an array f.e. Validator(array($first => 'first', $second => 'second', $third => 'third')) - an instance of Traversable f.e. Validator($config_instance)

__construct(array|\Traversable $options = null
Inherited

Parameters

$options

array\Traversable

Magic function returns the value of the requested property, if and only if it is the value or a message variable.

__get(string $property) : mixed
Inherited

Parameters

$property

string

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

mixed

Invoke as command

__invoke(mixed $value) : boolean
Inherited

Parameters

$value

mixed

Returns

boolean

Adds a CCI to be accepted by validation

addType(string|array $type) : \Zend\Validator\CreditCard

Parameters

$type

stringarray

Type to allow for validation

Returns

\Zend\Validator\CreditCardProvides a fluid interface

Get default translation object for all validate objects

getDefaultTranslator() : \Zend\Validator\Translator\TranslatorInterface | null
InheritedStatic

Returns

\Zend\Validator\Translator\TranslatorInterfacenull

Get default translation text domain for all validate objects

getDefaultTranslatorTextDomain() : string
InheritedStatic

Returns

string

Returns the maximum allowed message length

getMessageLength() : integer
InheritedStatic

Returns

integer

Returns the message templates from the validator

getMessageTemplates() : array
Inherited

Returns

array

Returns an array of the names of variables that are used in constructing validation failure messages

getMessageVariables() : array
Inherited

Returns

array

Returns array of validation failure messages

getMessages() : array
Inherited

If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.

inherited_from \Zend\Validator\ValidatorInterface::getMessages()

Returns

array

Returns an option

getOption(string $option) : mixed
Inherited

Parameters

$option

string

Option to be returned

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

mixedReturned option

Returns all available options

getOptions() : array
Inherited

Returns

arrayArray with all available options

Returns the actual set service

getService() : callable

Returns

callable

Return translation object

getTranslator() : \Zend\Validator\Translator\TranslatorInterface | null
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::getTranslator()

Returns

\Zend\Validator\Translator\TranslatorInterfacenull

Return the translation text domain

getTranslatorTextDomain() : string
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::getTranslatorTextDomain()

Returns

string

Returns a list of accepted CCIs

getType() : array

Returns

array

Is there a default translation object set?

hasDefaultTranslator() : boolean
InheritedStatic

Returns

boolean

Does this validator have its own specific translator?

hasTranslator() : boolean
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::hasTranslator()

Returns

boolean

Is translation enabled?

isTranslatorEnabled() : boolean
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::isTranslatorEnabled()

Returns

boolean

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

isValid(string $value) : boolean

Parameters

$value

string

Returns

boolean

Retrieve flag indicating whether or not value should be obfuscated in messages

isValueObscured() : boolean
Inherited

Returns

boolean

Set default translation object for all validate objects

setDefaultTranslator(\Zend\Validator\Translator\TranslatorInterface|null $translator = null, string $textDomain = null) : void
InheritedStatic

Parameters

$translator

\Zend\Validator\Translator\TranslatorInterfacenull

$textDomain

string

(optional)

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Set default translation text domain for all validate objects

setDefaultTranslatorTextDomain(string $textDomain = 'default') : void
InheritedStatic

Parameters

$textDomain

string

Sets the validation failure message template for a particular key

setMessage(string $messageString, string $messageKey = null) : \Zend\Validator\AbstractValidator
Inherited

Parameters

$messageString

string

$messageKey

string

OPTIONAL

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

\Zend\Validator\AbstractValidatorProvides a fluent interface

Sets the maximum allowed message length

setMessageLength(integer $length = -1
InheritedStatic

Parameters

$length

integer

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.

setMessages(array $messages) : \Zend\Validator\AbstractValidator
Inherited

Parameters

$messages

array

Returns

\Zend\Validator\AbstractValidator

Sets one or multiple options

setOptions(array|\Traversable $options = array()) : \Zend\Validator\AbstractValidator
Inherited

Parameters

$options

array\Traversable

Options to set

Exceptions

\Zend\Validator\Exception\InvalidArgumentException If $options is not an array or Traversable

Returns

\Zend\Validator\AbstractValidatorProvides fluid interface

Sets a new callback for service validation

setService(callable $service) : \Zend\Validator\CreditCard

Parameters

$service

callable

Exceptions

\Zend\Validator\Exception\InvalidArgumentException on invalid service callback

Returns

\Zend\Validator\CreditCard

Set translation object

setTranslator(\Zend\Validator\Translator\TranslatorInterface|null $translator = null, string $textDomain = null) : \Zend\Validator\AbstractValidator
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::setTranslator()

Parameters

$translator

\Zend\Validator\Translator\TranslatorInterfacenull

$textDomain

string

(optional)

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

\Zend\Validator\AbstractValidator

Indicate whether or not translation should be enabled

setTranslatorEnabled(boolean $flag = true) : \Zend\Validator\AbstractValidator
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::setTranslatorEnabled()

Parameters

$flag

boolean

Returns

\Zend\Validator\AbstractValidator

Set translation text domain

setTranslatorTextDomain(string $textDomain = 'default') : \Zend\Validator\AbstractValidator
Inherited
inherited_from \Zend\Validator\Translator\TranslatorAwareInterface::setTranslatorTextDomain()

Parameters

$textDomain

string

Returns

\Zend\Validator\AbstractValidator

Sets CCIs which are accepted by validation

setType(string|array $type) : \Zend\Validator\CreditCard

Parameters

$type

stringarray

Type to allow for validation

Returns

\Zend\Validator\CreditCardProvides a fluid interface

Set flag indicating whether or not value should be obfuscated in messages

setValueObscured(boolean $flag) : \Zend\Validator\AbstractValidator
Inherited

Parameters

$flag

boolean

Returns

\Zend\Validator\AbstractValidator

Constructs and returns a validation failure message with the given message key and value.

createMessage(string $messageKey, string|array|object $value) : string
Inherited

Returns null if and only if $messageKey does not correspond to an existing template.

If a translator is available and a translation exists for $messageKey, the translation will be used.

Parameters

$messageKey

string

$value

stringarrayobject

Returns

string

error()

error(string $messageKey, string $value = null) : void
Inherited

Parameters

$messageKey

string

$value

string

OPTIONAL

Returns the validation value

getValue() : mixed
Inherited

Returns

mixedValue to be validated

Sets the value to be validated and clears the messages and errors arrays

setValue(mixed $value) : void
Inherited

Parameters

$value

mixed

Translate a validation message

translateMessage(string $messageKey, string $message) : string
Inherited

Parameters

$messageKey

string

$message

string

Returns

string

 Properties

 

$abstractOptions

$abstractOptions 

Default

array('messages' => array(), 'messageTemplates' => array(), 'messageVariables' => array(), 'translator' => null, 'translatorTextDomain' => null, 'translatorEnabled' => true, 'valueObscured' => false)
 

List of allowed CCV lengths

$cardLength : array

Default

array(self::AMERICAN_EXPRESS => array(15), self::DINERS_CLUB => array(14), self::DINERS_CLUB_US => array(16), self::DISCOVER => array(16), self::JCB => array(15, 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))
 

List of CCV names

$cardName : array

Default

array(0 => self::AMERICAN_EXPRESS, 1 => self::DINERS_CLUB, 2 => self::DINERS_CLUB_US, 3 => self::DISCOVER, 4 => self::JCB, 5 => self::LASER, 6 => self::MAESTRO, 7 => self::MASTERCARD, 8 => self::SOLO, 9 => self::UNIONPAY, 10 => self::VISA)
 

List of accepted CCV provider tags

$cardType : array

Default

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('1800', '2131', '3528', '3529', '353', '354', '355', '356', '357', '358'), self::LASER => array('6304', '6706', '6771', '6709'), self::MAESTRO => array('5018', '5020', '5038', '6304', '6759', '6761', '6762', '6763', '6764', '6765', '6766'), 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'))
 

Default translation object for all validate objects

$defaultTranslator : \Zend\Validator\Translator\TranslatorInterface

Default

Static
 

Default text domain to be used with translator

$defaultTranslatorTextDomain : string

Default

'default'
Static
 

Limits the maximum returned length of an error message

$messageLength : integer

Default

-1
Static
 

Validation failure message template definitions

$messageTemplates : array

Default

array(self::CHECKSUM => "The input seems to contain an invalid checksum", self::CONTENT => "The input must contain only digits", self::INVALID => "Invalid type given. String expected", self::LENGTH => "The input contains an invalid amount of digits", self::PREFIX => "The input is not from an allowed institute", self::SERVICE => "The input seems to be an invalid credit card number", self::SERVICEFAILURE => "An exception has been raised while validating the input")
 

Options for this validator

$options : array

Default

array('service' => null, 'type' => array())
 

The value to be validated

$value : mixed

Default

 Constants

 

Detected CCI list

ALL = 'All' : string
 

AMERICAN_EXPRESS

AMERICAN_EXPRESS = 'American_Express' 
 

CHECKSUM

CHECKSUM = 'creditcardChecksum' 
 

CONTENT

CONTENT = 'creditcardContent' 
 

DINERS_CLUB

DINERS_CLUB = 'Diners_Club' 
 

DINERS_CLUB_US

DINERS_CLUB_US = 'Diners_Club_US' 
 

DISCOVER

DISCOVER = 'Discover' 
 

INVALID

INVALID = 'creditcardInvalid' 
 

JCB

JCB = 'JCB' 
 

LASER

LASER = 'Laser' 
 

LENGTH

LENGTH = 'creditcardLength' 
 

MAESTRO

MAESTRO = 'Maestro' 
 

MASTERCARD

MASTERCARD = 'Mastercard' 
 

PREFIX

PREFIX = 'creditcardPrefix' 
 

SERVICE

SERVICE = 'creditcardService' 
 

SERVICEFAILURE

SERVICEFAILURE = 'creditcardServiceFailure' 
 

SOLO

SOLO = 'Solo' 
 

UNIONPAY

UNIONPAY = 'Unionpay' 
 

VISA

VISA = 'Visa'