Validates IBAN Numbers (International Bank Account Numbers)

package Default
inherited_from \Zend\Validator\AbstractValidator

 Methods

Sets validator options

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

Parameters

$options

array\Traversable

OPTIONAL

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

Returns the optional allow non-sepa countries setting

allowNonSepa() : boolean

Returns

boolean

Returns the optional country code by ISO 3166-1

getCountryCode() : string | null

Returns

stringnull

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

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

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 $value is a valid IBAN

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

Sets the optional allow non-sepa countries setting

setAllowNonSepa(boolean $allowNonSepa) : \Zend\Validator\Iban

Parameters

$allowNonSepa

boolean

Returns

\Zend\Validator\Ibanprovides a fluent interface

Sets an optional country code by ISO 3166-1

setCountryCode(string|null $countryCode = null) : \Zend\Validator\Iban

Parameters

$countryCode

stringnull

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

\Zend\Validator\Ibanprovides a fluent interface

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

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

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)
 

Optionally allow IBAN codes from non-SEPA countries. Defaults to true

$allowNonSepa : boolean

Default

true
 

Optional country code by ISO 3166-1

$countryCode : string | null

Default

 

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
 

IBAN regexes by country code

$ibanRegex : array

Default

array('AD' => 'AD[0-9]{2}[0-9]{4}[0-9]{4}[A-Z0-9]{12}', 'AE' => 'AE[0-9]{2}[0-9]{3}[0-9]{16}', 'AL' => 'AL[0-9]{2}[0-9]{8}[A-Z0-9]{16}', 'AT' => 'AT[0-9]{2}[0-9]{5}[0-9]{11}', 'AZ' => 'AZ[0-9]{2}[A-Z]{4}[A-Z0-9]{20}', 'BA' => 'BA[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{8}[0-9]{2}', 'BE' => 'BE[0-9]{2}[0-9]{3}[0-9]{7}[0-9]{2}', 'BG' => 'BG[0-9]{2}[A-Z]{4}[0-9]{4}[0-9]{2}[A-Z0-9]{8}', 'BH' => 'BH[0-9]{2}[A-Z]{4}[A-Z0-9]{14}', 'BR' => 'BR[0-9]{2}[0-9]{8}[0-9]{5}[0-9]{10}[A-Z][A-Z0-9]', 'CH' => 'CH[0-9]{2}[0-9]{5}[A-Z0-9]{12}', 'CR' => 'CR[0-9]{2}[0-9]{3}[0-9]{14}', 'CY' => 'CY[0-9]{2}[0-9]{3}[0-9]{5}[A-Z0-9]{16}', 'CZ'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9]{5}[0-9]{5}[A-Z0-9]{12}', 'TN' => 'TN59[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}', 'TR' => 'TR[0-9]{2}[0-9]{5}[A-Z0-9]{1}[A-Z0-9]{16}', 'VG' => 'VG[0-9]{2}[A-Z]{4}[0-9]{16}')
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::NOTSUPPORTED => "Unknown country within the IBAN", self::SEPANOTSUPPORTED => "Countries outside the Single Euro Payments Area (SEPA) are not supported", self::FALSEFORMAT => "The input has a false IBAN format", self::CHECKFAILED => "The input has failed the IBAN check")
 

The SEPA country codes

$sepaCountries : \Zend\Validator\array<ISO

Default

array('AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'FO', 'GL', 'EE', 'FI', 'FR', 'DE', 'GI', 'GR', 'HU', 'IS', 'IE', 'IT', 'LV', 'LI', 'LT', 'LU', 'MT', 'MC', 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'CH', 'GB')
Static
 

The value to be validated

$value : mixed

Default

 Constants

 

CHECKFAILED

CHECKFAILED = 'ibanCheckFailed' 
 

FALSEFORMAT

FALSEFORMAT = 'ibanFalseFormat' 
 

NOTSUPPORTED

NOTSUPPORTED = 'ibanNotSupported' 
 

SEPANOTSUPPORTED

SEPANOTSUPPORTED = 'ibanSepaNotSupported'