Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
Zend_Validate_LessThan Class Reference
Inheritance diagram for Zend_Validate_LessThan:
Zend_Validate_Abstract Zend_Validate_Interface

Public Member Functions

 __construct ($max)
 
 getMax ()
 
 setMax ($max)
 
 isValid ($value)
 
- Public Member Functions inherited from Zend_Validate_Abstract
 getMessages ()
 
 getMessageVariables ()
 
 getMessageTemplates ()
 
 setMessage ($messageString, $messageKey=null)
 
 setMessages (array $messages)
 
 __get ($property)
 
 getErrors ()
 
 setObscureValue ($flag)
 
 getObscureValue ()
 
 setTranslator ($translator=null)
 
 getTranslator ()
 
 hasTranslator ()
 
 setDisableTranslator ($flag)
 
 translatorIsDisabled ()
 

Data Fields

const NOT_LESS = 'notLessThan'
 

Protected Attributes

 $_messageTemplates
 
 $_messageVariables
 
 $_max
 
- Protected Attributes inherited from Zend_Validate_Abstract
 $_value
 
 $_messageVariables = array()
 
 $_messageTemplates = array()
 
 $_messages = array()
 
 $_obscureValue = false
 
 $_errors = array()
 
 $_translator
 
 $_translatorDisabled = false
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Validate_Abstract
static setDefaultTranslator ($translator=null)
 
static getDefaultTranslator ()
 
static hasDefaultTranslator ()
 
static getMessageLength ()
 
static setMessageLength ($length=-1)
 
- Protected Member Functions inherited from Zend_Validate_Abstract
 _createMessage ($messageKey, $value)
 
 _implodeRecursive (array $pieces)
 
 _error ($messageKey, $value=null)
 
 _setValue ($value)
 
- Static Protected Attributes inherited from Zend_Validate_Abstract
static $_defaultTranslator
 
static $_messageLength = -1
 

Detailed Description

Definition at line 33 of file LessThan.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $max)

Sets validator options

Parameters
mixed | Zend_Config$max
Exceptions
Zend_Validate_Exception

Definition at line 64 of file LessThan.php.

65  {
66  if ($max instanceof Zend_Config) {
67  $max = $max->toArray();
68  }
69 
70  if (is_array($max)) {
71  if (array_key_exists('max', $max)) {
72  $max = $max['max'];
73  } else {
74  #require_once 'Zend/Validate/Exception.php';
75  throw new Zend_Validate_Exception("Missing option 'max'");
76  }
77  }
78 
79  $this->setMax($max);
80  }

Member Function Documentation

◆ getMax()

getMax ( )

Returns the max option

Returns
mixed

Definition at line 87 of file LessThan.php.

88  {
89  return $this->_max;
90  }

◆ isValid()

isValid (   $value)

Defined by Zend_Validate_Interface

Returns true if and only if $value is less than max option

Parameters
mixed$value
Returns
boolean

Implements Zend_Validate_Interface.

Definition at line 112 of file LessThan.php.

113  {
114  $this->_setValue($value);
115  if ($this->_max <= $value) {
116  $this->_error(self::NOT_LESS);
117  return false;
118  }
119  return true;
120  }
_error($messageKey, $value=null)
Definition: Abstract.php:284
$value
Definition: gender.phtml:16

◆ setMax()

setMax (   $max)

Sets the max option

Parameters
mixed$max
Returns
Zend_Validate_LessThan Provides a fluent interface

Definition at line 98 of file LessThan.php.

99  {
100  $this->_max = $max;
101  return $this;
102  }

Field Documentation

◆ $_max

$_max
protected

Definition at line 56 of file LessThan.php.

◆ $_messageTemplates

$_messageTemplates
protected
Initial value:
= array(
self::NOT_LESS => "'%value%' is not less than '%max%'"
)

Definition at line 40 of file LessThan.php.

◆ $_messageVariables

$_messageVariables
protected
Initial value:
= array(
'max' => '_max'
)

Definition at line 47 of file LessThan.php.

◆ NOT_LESS

const NOT_LESS = 'notLessThan'

Definition at line 35 of file LessThan.php.


The documentation for this class was generated from the following file: