Class implementing "fluent" design pattern for Jyxo_Input.
Allows chaining multiple validators and checking multiple values in one
validation cycle.
Methods summary
public
|
|
public
Jyxo_Input_Fluent
|
#
check( mixed $var, string $name )
Starts a new value checking.
Starts a new value checking.
Parameters
- $var
mixed Value to check.
- $name
string Variable name
Returns
|
public
Jyxo_Input_Fluent
|
#
all( )
Validates all variables.
Returns
|
public
Jyxo_Input_Fluent
|
#
defaultValue( mixed $value )
Sets a default value in case the validation fails.
Sets a default value in case the validation fails.
Parameters
- $value
mixed Default value
Returns
Throws
|
public
Jyxo_Input_Fluent
|
#
validate( string $name, string $errorMessage = null, mixed $param = null )
Adds a validator to the chain.
Adds a validator to the chain.
Parameters
- $name
string Validator name
- $errorMessage
string Validator error message
- $param
mixed Additional validator parameter
Returns
|
public
Jyxo_Input_Fluent
|
#
filter( string $name, mixed $param = null )
Adds a filter to the chain.s
Adds a filter to the chain.s
Parameters
- $name
string Filter name
- $param
mixed Additional filter parameter
Returns
|
public
Jyxo_Input_Fluent
|
#
walk( boolean $addFilter = true )
Adds a subchain to the current chain that treats the value a an array.
Automatically adds the isArray validator.
Adds a subchain to the current chain that treats the value a an array.
Automatically adds the isArray validator.
Parameters
- $addFilter
boolean Add the Trim filter (removes empty elements)
Returns
|
public
Jyxo_Input_Fluent
|
#
condition( string $name, mixed $param = null )
Adds a conditional chain.
Adds a conditional chain.
If there are conditions in the current chain, adds the condition as a
subchain.
Parameters
- $name
string Validator name
- $param
mixed Additional validator parameter
Returns
Throws
|
public
Jyxo_Input_Fluent
|
|
public
boolean
|
#
isValid( boolean $assocErrors = false )
Performs validation and filtering of all variables.
Performs validation and filtering of all variables.
Parameters
- $assocErrors
boolean Return error messages in an associative array
Returns
boolean
|
public
|
#
validateAll( )
Calls isValid(), but throws an exception on error.
Calls isValid(), but throws an exception on error.
The exception contains only the first validation error message.
Throws
|
public
array
|
|
public
mixed
|
#
getValue( string $name )
Returns a value by name.
Parameters
- $name
string Variable name
Returns
mixed
Throws
|
public
array
|
|
public
Jyxo_Input_Fluent
|
#
post( string $name, mixed $default = null )
Checks a POST variable.
Parameters
- $name
string Variable name
- $default
mixed Default value
Returns
|
public
Jyxo_Input_Fluent
|
#
query( string $name, mixed $default = null )
Checks a GET variable.
Parameters
- $name
string Variable name
- $default
mixed Default value
Returns
|
public
Jyxo_Input_Fluent
|
#
request( string $name, mixed $default = null )
Checks a POST/GET variable
Checks a POST/GET variable
Parameters
- $name
string Variable name
- $default
mixed Default value
Returns
|
public
Jyxo_Input_Fluent
|
#
file( string $index )
Checks file upload.
Requires Jyxo_Input_Upload.
Parameters
Returns
See
|
public
mixed
|
#
__get( string $offset )
Magic getter for easier retrieving of values.
Magic getter for easier retrieving of values.
Parameters
- $offset
string Value name
Returns
mixed
Throws
|