Abstract implementation of range comparsion rules
| package | Formagic\Rule |
|---|---|
| author | Florian Sonnenburg |
| since | 1.1.0 First time introduced |
| inherited_from | \Formagic_Rule_Abstract |
__construct(array $arguments = array())
getMessage() : string
stringMessage stringgetName() : string
stringThe rule namesetMessage(string $message)
Usually a rule will have one error message string that is used if the validation fails. If neccessary, Formagic_Rule_Abstract::_errorMessage can hold other variables, eg. an array of error messages for different outcomes of the validation process.
Implements a fluent interface pattern.
| inherited_from | \Formagic_Rule_Abstract::setMessage() |
|---|
stringNew message string
\Formagic_Exception |
|---|
setMessage(mixed $message) : \Formagic_Rule_Abstract
Usually a rule will have one error message string that is used if the validation fails. If neccessary, Formagic_Rule_Abstract::_errorMessage can hold other variables, eg. an array of error messages for different outcomes of the validation process.
Implements a fluent interface pattern.
| see |
|---|
mixedThe error message value.
\Formagic_Rule_Abstract$this object.setMessages(array $messages) : \Formagic_Rule_RangeComparison_Abstract
arrayArray of messages
\Formagic_Rule_RangeComparison_Abstractvalidate(string $value) : boolean
Length rule checks if value is between min and max length. The validation method depends on $this->_type.
| inherited_from | \Formagic_Rule_Abstract::validate() |
|---|
stringThe item to checked
booleanThe validation resultvalidate(string $value) : boolean
Subclasses have to implement their behavior here.
stringThe value to be validated.
booleanThe rule check result_execBetween(integer $range) : boolean
integerRange value
booleanEvaluation result_execMax(integer $range) : boolean
integerUpper limit
booleanEvaluation result_execMin(integer $range) : boolean
integerLower limit
booleanEvaluation result_getMessage(string $key) : string
stringMessage type
stringTranslated filled message_getRange(string $value) : mixed
stringItem value
mixedCheck range value_init(array $arguments) : void
Allowed options for this rule are:
Will throw an exception, if neither "min" nor "max" option provided.
| inherited_from | \Formagic_Rule_Abstract::_init() |
|---|
arrayArray of arguments passed to __construct()
_init(array $arguments) : void
arrayArray of arguments passed to __construct()
_isNoUserValue($value) : boolean
The value 0 (zero) for example could be something the user entered willingly and would be skipped from rule checks when using empty().
mixed Value to be checked
boolean$_max : integer
$_min : integer
$_name : string