PHP Class Jyxo\Input\Chain

Author: Jakub Tománek
Inheritance: implements Jyxo\Input\ValidatorInterface
Datei anzeigen Open project: jyxo/php Class Usage Examples

Protected Properties

Property Type Description
$value mixed Actual variable value.

Public Methods

Method Description
addCondition ( Conditional $chain ) : self Adds a new conditional subchain and returns its instance.
addFilter ( Jyxo\Input\FilterInterface $filter ) : self Adds a filter to the chain.
addValidator ( Jyxo\Input\ValidatorInterface $validator, string $errorMessage = null ) : Chain Adds a validator to the chain.
addWalk ( ) : self Adds a new subchain and returns its instance.
close ( ) : self In case of a subchain returns its parent, the chain itself otherwise.
getErrors ( ) : array Returns a list of validation errors.
getParent ( ) : self Returns the parent chain.
getValue ( ) : mixed Returns a filtered variable value.
isEmpty ( ) : boolean Returns if the chain contains any rules.
isValid ( mixed $value ) : boolean Returns if the value is valid.
setParent ( Chain $parent ) : self Sets the parent chain.

Private Methods

Method Description
run ( mixed &$value ) : boolean Starts filtering and validation.

Method Details

addCondition() public method

Adds a new conditional subchain and returns its instance.
public addCondition ( Conditional $chain ) : self
$chain Jyxo\Input\Chain\Conditional
return self

addFilter() public method

Adds a filter to the chain.
public addFilter ( Jyxo\Input\FilterInterface $filter ) : self
$filter Jyxo\Input\FilterInterface Filter
return self

addValidator() public method

Adds a validator to the chain.
public addValidator ( Jyxo\Input\ValidatorInterface $validator, string $errorMessage = null ) : Chain
$validator Jyxo\Input\ValidatorInterface Validator
$errorMessage string Validation error message
return Chain

addWalk() public method

Adds a new subchain and returns its instance.
public addWalk ( ) : self
return self

close() public method

In case of a subchain returns its parent, the chain itself otherwise.
public close ( ) : self
return self

getErrors() public method

Returns a list of validation errors.
public getErrors ( ) : array
return array

getParent() public method

Returns the parent chain.
public getParent ( ) : self
return self

getValue() public method

Returns a filtered variable value.
public getValue ( ) : mixed
return mixed

isEmpty() public method

Returns if the chain contains any rules.
public isEmpty ( ) : boolean
return boolean

isValid() public method

Returns if the value is valid.
public isValid ( mixed $value ) : boolean
$value mixed Input value
return boolean

setParent() public method

Sets the parent chain.
public setParent ( Chain $parent ) : self
$parent Chain Parent chain
return self

Property Details

$value protected_oe property

Actual variable value.
protected mixed $value
return mixed