category Zend
package Zend_Validate
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Validate_Abstract

 Methods

Constructor

__construct(string|array|\Zend_Config $options = array()

Parameters

$options

stringarray\Zend_Config

OPTIONAL Type of CCI to allow

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_Validate_Exception

Returns

mixed

Adds a CCI to be accepted by validation

addType(string|array $type) : \Zend_Validate_CreditCard

Parameters

$type

stringarray

Type to allow for validation

Returns

\Zend_Validate_CreditCardProvides a fluent interface

Get default translation object for all validate objects

getDefaultTranslator() : \Zend_Translate_Adapter | null
InheritedStatic

Returns

\Zend_Translate_Adapternull

Returns array of validation failure message codes

getErrors() : array
Inherited
deprecated Since 1.5.0

Returns

array

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_Validate_Interface::getMessages()

Returns

array

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

getObscureValue() : boolean
Inherited

Returns

boolean

Returns the actual set service

getService() : callback

Returns

callback

Return translation object

getTranslator() : \Zend_Translate_Adapter | null
Inherited

Returns

\Zend_Translate_Adapternull

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

Returns

boolean

Defined by Zend_Validate_Interface

isValid(string $value) : boolean

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

Parameters

$value

string

Returns

boolean

Set default translation object for all validate objects

setDefaultTranslator(\Zend_Translate|\Zend_Translate_Adapter|null $translator = null
InheritedStatic

Parameters

$translator

\Zend_Translate\Zend_Translate_Adapternull

Exceptions

\Zend_Validate_Exception

Indicate whether or not translation should be disabled

setDisableTranslator(boolean $flag) : \Zend_Validate_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Validate_Abstract

Sets the validation failure message template for a particular key

setMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract
Inherited

Parameters

$messageString

string

$messageKey

string

OPTIONAL

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_AbstractProvides 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_Validate_Abstract
Inherited

Parameters

$messages

array

Returns

\Zend_Validate_Abstract

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

setObscureValue(boolean $flag) : \Zend_Validate_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Validate_Abstract

Sets a new callback for service validation

setService(mixed $service) : \Zend_Validate_CreditCard
fluent This method is part of a fluent interface and will return the same instance

Parameters

$service

mixed

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_CreditCard

Set translation object

setTranslator(\Zend_Translate|\Zend_Translate_Adapter|null $translator = null) : \Zend_Validate_Abstract
Inherited

Parameters

$translator

\Zend_Translate\Zend_Translate_Adapternull

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_Abstract

Sets CCIs which are accepted by validation

setType(string|array $type) : \Zend_Validate_CreditCard

Parameters

$type

stringarray

Type to allow for validation

Returns

\Zend_Validate_CreditCardProvides a fluent interface

Is translation disabled?

translatorIsDisabled() : boolean
Inherited

Returns

boolean

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

_createMessage(string $messageKey, string $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

string

Returns

string

_error()

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

Parameters

$messageKey

string

$value

string

OPTIONAL

Joins elements of a multidimensional array

_implodeRecursive(array $pieces) : string
Inherited

Parameters

$pieces

array

Returns

string

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

_setValue(mixed $value) : void
Inherited

Parameters

$value

mixed

 Properties

 

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(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 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('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'))
 

Default translation object for all validate objects

$_defaultTranslator : \Zend_Translate

Default

Static
 

Array of validation failure message codes

$_errors : array

Default

array()
deprecated Since 1.5.0
 

Limits the maximum returned length of a error message

$_messageLength : Integer

Default

-1
Static
 

Validation failure message template definitions

$_messageTemplates : array

Default

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%'")
inherited_from \Zend_Validate_Abstract::_messageTemplates
 

Validation failure message template definitions

$_messageTemplates : array

Default

array()
 

Additional variables available for validation failure messages

$_messageVariables : array

Default

array()
 

Array of validation failure messages

$_messages : array

Default

array()
 

Flag indidcating whether or not value should be obfuscated in error messages

$_obscureValue : boolean

Default

false
 

Service callback for additional validation

$_service : callback

Default

 

Translation object

$_translator : \Zend_Translate

Default

 

Is translation disabled?

$_translatorDisabled : Boolean

Default

false
 

CCIs which are accepted by validation

$_type : array

Default

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'