PHP Interface Fuel\Validation\RuleInterface

Since: 2.0
Author: Fuel Development Team
Datei anzeigen Open project: fuelphp/validation Interface Usage Examples

Public Methods

Method Description
canAlwaysRun ( ) : boolean TODO: Docblock
getMessage ( ) : string Gets the failure message for this rule
getMessageParameters ( ) : string[] Returns a list of tokens that will be injected into the message before it is returned from getMessage
getParameter ( ) : mixed Returns the value of the set parameter.
setMessage ( string $message ) Sets the failure message for this rule
setParameter ( mixed $params ) Sets the parameter for this validation rule.
validate ( mixed $value, string $field = null, array $allFields = null ) : boolean | Fuel\Validation\ResultInterface Performs validation on the given value.

Method Details

canAlwaysRun() public method

TODO: Docblock
public canAlwaysRun ( ) : boolean
return boolean

getMessage() public method

Gets the failure message for this rule
Since: 2.0
public getMessage ( ) : string
return string

getMessageParameters() public method

Returns a list of tokens that will be injected into the message before it is returned from getMessage
Since: 2.0
public getMessageParameters ( ) : string[]
return string[]

getParameter() public method

See each Rule's documentation for what the parameter does.
Since: 2.0
public getParameter ( ) : mixed
return mixed

setMessage() public method

Sets the failure message for this rule
Since: 2.0
public setMessage ( string $message )
$message string

setParameter() public method

See each Rule's documentation for what this should be.
Since: 2.0
public setParameter ( mixed $params )
$params mixed

validate() public method

$field and $allFields are optional values to allow the validation rule to have some idea of context. This allows for rules such as "required" and "match field", validation rules that act on all the data rather than a single field. If a validation rule requires $field or $allFields but is not passed a value the rule should return false rather than throwing an exception.
Since: 2.0
public validate ( mixed $value, string $field = null, array $allFields = null ) : boolean | Fuel\Validation\ResultInterface
$value mixed Value to validate
$field string Name of the field that is being validated
$allFields array Values of all the other fields being validated
return boolean | Fuel\Validation\ResultInterface