PHP Interface Fuel\Validation\RuleInterface

Since: 2.0
Author: Fuel Development Team
Afficher le fichier Open project: fuelphp/validation Interface Usage Examples

Méthodes publiques

Méthode 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 méthode

TODO: Docblock
public canAlwaysRun ( ) : boolean
Résultat boolean

getMessage() public méthode

Gets the failure message for this rule
Since: 2.0
public getMessage ( ) : string
Résultat string

getMessageParameters() public méthode

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

getParameter() public méthode

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

setMessage() public méthode

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

setParameter() public méthode

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

validate() public méthode

$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
Résultat boolean | Fuel\Validation\ResultInterface