PHP Interface Fuel\Validation\ResultInterface

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

Méthodes publiques

Méthode Description
getError ( string $field ) : string Gets an error message for the given field. Will return null if there is no message.
getErrors ( ) : string[] Returns a list of all validation errors.
getFailedRules ( ) : Fuel\Validation\RuleInterface[] Returns a list of rules that caused fields to fail, indexed by the field name.
getValidated ( ) : string[] Returns a list of fields that where successfully validated.
isValid ( ) : boolean True if the validation passed
merge ( Fuel\Validation\ResultInterface $resultInterface, string $fieldPrefix = '' ) Merges the result from the given interface to this result.
setError ( string $field, string $message, string $rule ) Sets the message for a given field.
setResult ( boolean $isValid ) Sets a true false flag for if the validation result is successful or not.
setValidated ( string $field ) Sets the name of a field that has passed validation

Method Details

getError() public méthode

Gets an error message for the given field. Will return null if there is no message.
Since: 2.0
public getError ( string $field ) : string
$field string
Résultat string

getErrors() public méthode

Returns a list of all validation errors.
Since: 2.0
public getErrors ( ) : string[]
Résultat string[]

getFailedRules() public méthode

Returns a list of rules that caused fields to fail, indexed by the field name.
Since: 2.0
public getFailedRules ( ) : Fuel\Validation\RuleInterface[]
Résultat Fuel\Validation\RuleInterface[]

getValidated() public méthode

Returns a list of fields that where successfully validated.
Since: 2.0
public getValidated ( ) : string[]
Résultat string[]

isValid() public méthode

True if the validation passed
Since: 2.0
public isValid ( ) : boolean
Résultat boolean

merge() public méthode

Merges the result from the given interface to this result.
public merge ( Fuel\Validation\ResultInterface $resultInterface, string $fieldPrefix = '' )
$resultInterface Fuel\Validation\ResultInterface
$fieldPrefix string Prefix to be added to any field names.

setError() public méthode

Sets the message for a given field.
Since: 2.0
public setError ( string $field, string $message, string $rule )
$field string
$message string
$rule string

setResult() public méthode

Sets a true false flag for if the validation result is successful or not.
Since: 2.0
public setResult ( boolean $isValid )
$isValid boolean

setValidated() public méthode

Sets the name of a field that has passed validation
Since: 2.0
public setValidated ( string $field )
$field string