__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() |
arrayThe rule options.
getMessage() : string
| inherited_from | \Formagic_Rule_Abstract::getMessage() |
|---|---|
| inherited_from | \Formagic_Rule_RangeComparsion_Abstract::getMessage() |
stringMessage stringgetName() : string
| inherited_from | \Formagic_Rule_Abstract::getName() |
|---|---|
| inherited_from | \Formagic_Rule_RangeComparsion_Abstract::getName() |
stringThe 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() |
|---|
stringNew message string
\Formagic_Exception |
|---|
\Formagic_Rule_Abstract$this object.setMessages(array $messages) : \Formagic_Rule_RangeComparsion_Abstract
| inherited_from | \Formagic_Rule_RangeComparsion_Abstract::setMessages() |
|---|
arrayArray 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() |
|---|
stringThe item to checked
booleanThe validation result_execBetween(integer $range) : boolean
| inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_execBetween() |
|---|
integerRange value
booleanEvaluation result_execMax(integer $range) : boolean
| inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_execMax() |
|---|
integerUpper limit
booleanEvaluation result_execMin(integer $range) : boolean
| inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_execMin() |
|---|
integerLower limit
booleanEvaluation result_getMessage(string $key) : string
| inherited_from | \Formagic_Rule_RangeComparsion_Abstract::_getMessage() |
|---|
stringMessage type
stringTranslated filled message_getRange(string $value) : integer
stringItem value
integerRange 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() |
|---|
arrayArray 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() |
\$valuemixed 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 |