Class ZipCode
Responsibility: Validate ZIP code by specific locale rules.
- MvcCore\Ext\Forms\Validator implements MvcCore\Ext\Forms\IValidator
-
MvcCore\Ext\Forms\Validators\ZipCode
Namespace: MvcCore\Ext\Forms\Validators
See: https://github.com/zendframework/zend-i18n
See: https://github.com/zendframework/zend-i18n/blob/master/src/Validator/PostCode.php
Located at ext-form-validator-special/src/MvcCore/Ext/Forms/Validators/ZipCode.php
See: https://github.com/zendframework/zend-i18n
See: https://github.com/zendframework/zend-i18n/blob/master/src/Validator/PostCode.php
Located at ext-form-validator-special/src/MvcCore/Ext/Forms/Validators/ZipCode.php
public static
string|callable
|
#
SetValidator( string $localeCode, string|callable $regExpMatchOrCallable )
Set specific locale validator for ZIP code.
It could be |
public static
array
&
|
#
GetValidators( )
Get all preconfigured validators as key/value array.
Keys are locale codes and values are |
public
string|null
|
|
protected
array
|
#
validateZipByRegExp( string $zip, string $regExpMatch, string $localeCode )
Validate ZIP code by regular expression match pattern. Return if matches and safe ZIP code value. |
CreateInstance(),
GetErrorMessage(),
SetField(),
SetForm(),
__construct(),
setUpFieldProps(),
throwNewInvalidArgumentException()
|
integer |
ERROR_NOT_SUPPORTED
Error message index(es). |
#
0
|
integer |
ERROR_VALIDATOR_WRONG_FORMAT
|
#
1
|
integer |
ERROR_WRONG_PATTERN
|
#
2
|
integer |
ERROR_INVALID_ZIP
|
#
3
|
protected static
array
|
$errorMessages
Validation failure message template definitions. |
#
[
self::ERROR_NOT_SUPPORTED => "Field '{0}' has not supported validation for ZIP code in locale: `{1}`.",
self::ERROR_VALIDATOR_WRONG_FORMAT => "Field '{0}' has ZIP code validator in locale `{1}` in wrong format.",
self::ERROR_WRONG_PATTERN => "Field '{0}' has wrong ZIP code validation pattern: `{1}`.",
self::ERROR_INVALID_ZIP => "Field '{0}' requires a valid zip code.",
]
|
protected static
array
|
$validators
All configured validators as key/value array.
Keys are locale codes and values are regular expression match pattern strings or |
#
[]
|
$field,
$fieldSpecificProperties,
$form,
$toolClass
|