__construct()
getMessage()
getName()
setMessage()
setMessages()
validate()
_execBetween()
_execMax()
_execMin()
_getMessage()
_getRange()
_init()
_isNoUserValue()
$_max
$_message
$_messages
$_min
$_name
Checks if value is between min and max length
If only one numeric value is passed as argument, this value is interpreted as min length value.
Supported arguments are:
Formagic_Rule_StringLength::__construct(array(
'min' => (int)$min,
'max' => (int)$max,
'messages' => array(
'min' => (string)$errorMessage,
'min' => (string)$errorMessage,
'between' => (string)$errorMessage,
)
));
Formagic_Rule_StringLength::__construct(array('min' => (int)$min, 'max' => (int)$max));
category | Formagic |
---|---|
package | Rule |
subpackage | RangeComparsion |
author | Florian Sonnenburg |
author | Marc Schrader |
copyright | Copyright (c) 2007-2011 Florian Sonnenburg |
version | $Id: StringLength.php 160 2012-04-02 20:18:14Z meweasle $ |
__construct(array $arguments)
The default error message that is displayed if the rule is violated can be overwritten by $errorMessage.
see | \self::_init() |
---|---|
inherited_from | \Formagic_Rule_Abstract::__construct() |
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::__construct() |
array
The rule options.
getMessage() : string
inherited_from | \Formagic_Rule_Abstract::getMessage() |
---|---|
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::getMessage() |
string
Message stringgetName() : string
inherited_from | \Formagic_Rule_Abstract::getName() |
---|---|
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::getName() |
string
The rule namesetMessage(string $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.
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::setMessage() |
---|
string
New message string
\Formagic_Exception |
---|
\Formagic_Rule_Abstract
$this object.setMessages(array $messages) : \Formagic_Rule_RangeComparsion_Abstract
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::setMessages() |
---|
array
Array of messages
validate(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_RangeComparsion_Abstract::validate() |
---|
string
The item to checked
boolean
The validation result_execBetween(integer $range) : boolean
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_execBetween() |
---|
integer
Range value
boolean
Evaluation result_execMax(integer $range) : boolean
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_execMax() |
---|
integer
Upper limit
boolean
Evaluation result_execMin(integer $range) : boolean
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_execMin() |
---|
integer
Lower limit
boolean
Evaluation result_getMessage(string $key) : string
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_getMessage() |
---|
string
Message type
string
Translated filled message_getRange(string $value) : integer
string
Item value
integer
Range check 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_RangeComparsion_Abstract::_init() |
---|
array
Array of arguments passed to __construct()
_isNoUserValue(\$value $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().
inherited_from | \Formagic_Rule_Abstract::_isNoUserValue() |
---|---|
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_isNoUserValue() |
\$value
mixed Value to be checked
boolean
$_max : integer
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::$$_max |
---|
$_min : integer
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::$$_min |
---|
$_name : string
inherited_from | \Formagic_Rule_Abstract::$$_name |
---|---|
inherited_from | \Formagic_Rule_RangeComparsion_Abstract::$$_name |