class Rules implements IteratorAggregate

List of validation & condition rules.

Properties

static deprecated $defaultMessages

Methods

__construct(IControl $control)

No description

setRequired($value = true)

Makes control mandatory.

bool
isRequired()

Is control mandatory?

isOptional()

No description

addRule($validator, $errorMessage = null, $arg = null)

Adds a validation rule for the current control.

addCondition($validator, $arg = null)

Adds a validation condition and returns new branch.

addConditionOn(IControl $control, $validator, $arg = null)

Adds a validation condition on specified control a returns new branch.

elseCondition()

Adds a else statement.

endCondition()

Ends current validation condition.

addFilter($filter)

Adds a filter callback.

toggle($id, $hide = true)

Toggles HTML element visibility.

array
getToggles($actual = false)

No description

array
getToggleStates($toggles = [], $success = true)

No description

bool
validate($emptyOptional = false)

Validates against ruleset.

check()

No description

reset()

Clear all validation rules.

static bool
validateRule(Rule $rule)

Validates single rule.

getIterator()

Iterates over complete ruleset.

Details

at line 39
__construct(IControl $control)

No description

Parameters

IControl $control

at line 50
Rules setRequired($value = true)

Makes control mandatory.

Parameters

$value

Return Value

Rules

at line 65
bool isRequired()

Is control mandatory?

Return Value

bool

at line 74
isOptional()

internal  
 

No description

at line 87
Rules addRule($validator, $errorMessage = null, $arg = null)

Adds a validation rule for the current control.

Parameters

$validator
$errorMessage
$arg

Return Value

Rules

at line 113
Rules addCondition($validator, $arg = null)

Adds a validation condition and returns new branch.

Parameters

$validator
$arg

Return Value

Rules

new branch

at line 132
Rules addConditionOn(IControl $control, $validator, $arg = null)

Adds a validation condition on specified control a returns new branch.

Parameters

IControl $control
$validator
$arg

Return Value

Rules

new branch

at line 151
Rules elseCondition()

Adds a else statement.

Return Value

Rules

else branch

at line 166
Rules endCondition()

Ends current validation condition.

Return Value

Rules

parent branch

at line 177
Rules addFilter($filter)

Adds a filter callback.

Parameters

$filter

Return Value

Rules

at line 196
Rules toggle($id, $hide = true)

Toggles HTML element visibility.

Parameters

$id
$hide

Return Value

Rules

at line 207
array getToggles($actual = false)

No description

Parameters

$actual

Return Value

array

at line 217
array getToggleStates($toggles = [], $success = true)

internal  
 

No description

Parameters

$toggles
$success

Return Value

array

at line 236
bool validate($emptyOptional = false)

Validates against ruleset.

Parameters

$emptyOptional

Return Value

bool

at line 260
check()

internal  
 

No description

at line 283
reset()

Clear all validation rules.

at line 293
static bool validateRule(Rule $rule)

Validates single rule.

Parameters

Rule $rule

Return Value

bool

at line 308
Iterator getIterator()

Iterates over complete ruleset.

Return Value

Iterator

Traits

SmartObject