Definition at line 33 of file Abstract.php.
◆ __get()
Magic function returns the value of the requested property, if and only if it is the value or a message variable.
- Parameters
-
- Returns
- mixed
- Exceptions
-
- See also
- Zend_Validate_Exception
Definition at line 183 of file Abstract.php.
185 if ($property ==
'value') {
188 if (array_key_exists($property, $this->_messageVariables)) {
189 return $this->{$this->_messageVariables[$property]};
194 #require_once 'Zend/Validate/Exception.php';
◆ _createMessage()
_createMessage |
( |
|
$messageKey, |
|
|
|
$value |
|
) |
| |
|
protected |
Constructs and returns a validation failure message with the given message key and value.
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
-
string | $messageKey | |
string | $value | |
- Returns
- string
Definition at line 210 of file Abstract.php.
212 if (!isset($this->_messageTemplates[$messageKey])) {
216 $message = $this->_messageTemplates[$messageKey];
219 if ($translator->isTranslated($messageKey)) {
220 $message = $translator->translate($messageKey);
227 if (!in_array(
'__toString', get_class_methods(
$value))) {
243 foreach ($this->_messageVariables as $ident => $property) {
246 implode(
' ', (array) $this->$property),
252 if (($length > -1) && (strlen(
$message) > $length)) {
_implodeRecursive(array $pieces)
elseif(isset( $params[ 'redirect_parent']))
static getMessageLength()
◆ _error()
_error |
( |
|
$messageKey, |
|
|
|
$value = null |
|
) |
| |
|
protected |
- Parameters
-
string | $messageKey | |
string | $value | OPTIONAL |
- Returns
- void
Definition at line 284 of file Abstract.php.
286 if ($messageKey ===
null) {
287 $keys = array_keys($this->_messageTemplates);
288 $messageKey = current($keys);
293 $this->_errors[] = $messageKey;
_createMessage($messageKey, $value)
◆ _implodeRecursive()
_implodeRecursive |
( |
array |
$pieces | ) |
|
|
protected |
Joins elements of a multidimensional array
- Parameters
-
- Returns
- string
Definition at line 265 of file Abstract.php.
268 foreach ($pieces as
$item) {
269 if (is_array(
$item)) {
_implodeRecursive(array $pieces)
◆ _setValue()
Sets the value to be validated and clears the messages and errors arrays
- Parameters
-
- Returns
- void
Definition at line 303 of file Abstract.php.
306 $this->_messages = array();
307 $this->_errors = array();
◆ getDefaultTranslator()
static getDefaultTranslator |
( |
| ) |
|
|
static |
Get default translation object for all validate objects
- Returns
- Zend_Translate_Adapter|null
Definition at line 415 of file Abstract.php.
417 if (
null === self::$_defaultTranslator) {
418 #require_once 'Zend/Registry.php'; 424 return $translator->getAdapter();
elseif(isset( $params[ 'redirect_parent']))
static isRegistered($index)
static $_defaultTranslator
◆ getErrors()
Returns array of validation failure message codes
- Returns
- array
- Deprecated:
- Since 1.5.0
Definition at line 316 of file Abstract.php.
◆ getMessageLength()
static getMessageLength |
( |
| ) |
|
|
static |
Returns the maximum allowed message length
- Returns
- integer
Definition at line 469 of file Abstract.php.
◆ getMessages()
◆ getMessageTemplates()
Returns the message templates from the validator
- Returns
- array
Definition at line 128 of file Abstract.php.
◆ getMessageVariables()
Returns an array of the names of variables that are used in constructing validation failure messages
- Returns
- array
Definition at line 118 of file Abstract.php.
120 return array_keys($this->_messageVariables);
◆ getObscureValue()
Retrieve flag indicating whether or not value should be obfuscated in messages
- Returns
- bool
Definition at line 339 of file Abstract.php.
◆ getTranslator()
Return translation object
- Returns
- Zend_Translate_Adapter|null
Definition at line 369 of file Abstract.php.
375 if (
null === $this->_translator) {
static getDefaultTranslator()
◆ hasDefaultTranslator()
static hasDefaultTranslator |
( |
| ) |
|
|
static |
Is there a default translation object set?
- Returns
- boolean
Definition at line 437 of file Abstract.php.
static $_defaultTranslator
◆ hasTranslator()
Does this validator have its own specific translator?
- Returns
- bool
Definition at line 387 of file Abstract.php.
◆ setDefaultTranslator()
static setDefaultTranslator |
( |
|
$translator = null | ) |
|
|
static |
Set default translation object for all validate objects
- Parameters
-
- Exceptions
-
Definition at line 398 of file Abstract.php.
401 self::$_defaultTranslator = $translator;
403 self::$_defaultTranslator = $translator->getAdapter();
405 #require_once 'Zend/Validate/Exception.php'; elseif(isset( $params[ 'redirect_parent']))
◆ setDisableTranslator()
setDisableTranslator |
( |
|
$flag | ) |
|
Indicate whether or not translation should be disabled
- Parameters
-
- Returns
- Zend_Validate_Abstract
Definition at line 448 of file Abstract.php.
450 $this->_translatorDisabled = (bool) $flag;
◆ setMessage()
setMessage |
( |
|
$messageString, |
|
|
|
$messageKey = null |
|
) |
| |
Sets the validation failure message template for a particular key
- Parameters
-
string | $messageString | |
string | $messageKey | OPTIONAL |
- Returns
- Zend_Validate_Abstract Provides a fluent interface
- Exceptions
-
Definition at line 141 of file Abstract.php.
143 if ($messageKey ===
null) {
144 $keys = array_keys($this->_messageTemplates);
145 foreach($keys as $key) {
151 if (!isset($this->_messageTemplates[$messageKey])) {
152 #require_once 'Zend/Validate/Exception.php'; 156 $this->_messageTemplates[$messageKey] = $messageString;
setMessage($messageString, $messageKey=null)
◆ setMessageLength()
static setMessageLength |
( |
|
$length = -1 | ) |
|
|
static |
Sets the maximum allowed message length
- Parameters
-
Definition at line 479 of file Abstract.php.
481 self::$_messageLength = $length;
◆ setMessages()
setMessages |
( |
array |
$messages | ) |
|
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.
- Parameters
-
- Returns
- Zend_Validate_Abstract
Definition at line 167 of file Abstract.php.
169 foreach ($messages as $key =>
$message) {
setMessage($messageString, $messageKey=null)
◆ setObscureValue()
Set flag indicating whether or not value should be obfuscated in messages
- Parameters
-
- Returns
- Zend_Validate_Abstract
Definition at line 327 of file Abstract.php.
329 $this->_obscureValue = (bool) $flag;
◆ setTranslator()
setTranslator |
( |
|
$translator = null | ) |
|
Set translation object
- Parameters
-
- Exceptions
-
- Returns
- Zend_Validate_Abstract
Definition at line 351 of file Abstract.php.
354 $this->_translator = $translator;
356 $this->_translator = $translator->getAdapter();
358 #require_once 'Zend/Validate/Exception.php'; elseif(isset( $params[ 'redirect_parent']))
◆ translatorIsDisabled()
Is translation disabled?
- Returns
- bool
Definition at line 459 of file Abstract.php.
◆ $_defaultTranslator
◆ $_errors
◆ $_messageLength
◆ $_messages
◆ $_messageTemplates
$_messageTemplates = array() |
|
protected |
◆ $_messageVariables
$_messageVariables = array() |
|
protected |
◆ $_obscureValue
◆ $_translator
◆ $_translatorDisabled
$_translatorDisabled = false |
|
protected |
◆ $_value
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Validate/Abstract.php