Checks if dependencies between given items are matched
| package | Formagic\Rule |
|---|---|
| author | Florian Sonnenburg |
| since | 1.0.0 First time introduced |
| inherited_from | \Formagic_Rule_Abstract |
__construct(array $arguments = array())
getMessage() : string
stringMessage stringgetName() : string
stringThe rule namesetMessage(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.validate(string $value) : boolean
Subclasses have to implement their behavior here.
| inherited_from | \Formagic_Rule_Abstract::validate() |
|---|
stringValue to be checked
booleanTrue if conditions are matchedvalidate(string $value) : boolean
Subclasses have to implement their behavior here.
stringThe value to be validated.
booleanThe rule check result_init(array $arguments)
Supported keys:
Scenario: Given item $item shall be valid if dependent item $dep
has a value of 1.
$arguments = array(
['item'] => $dep,
['condition'] => Formagic_Rule_ItemDependency::COND_VALUE_EQUALS,
['requirement'] => 1,
);
| inherited_from | \Formagic_Rule_Abstract::_init() |
|---|
arrayRule options.
\Formagic_Exception |
If key "item", "condition" or "requirement" is not provided or has invalid value |
|---|
_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$_condition : integer
$_item : \Formagic_Item_Abstract
array()$_requirement : mixed
$_name : string
COND_VALUE_EQUALS = 1
..")
COND_VALUE_NOT_EQUALS = 2
..")
VALUE_ANY = true
VALUE_NONE = ''
VALUE_XOR = '__FM__VALUE_XOR__'
| todo | Implement Formagic_Rule_ItemDependency::VALUE_XOR |
|---|