PHP Interface Fuel\Validation\ResultInterface

Since: 2.0
Author: Fuel Development Team
显示文件 Open project: fuelphp/validation Interface Usage Examples

Public Methods

Method 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 method

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
return string

getErrors() public method

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

getFailedRules() public method

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

getValidated() public method

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

isValid() public method

True if the validation passed
Since: 2.0
public isValid ( ) : boolean
return boolean

merge() public method

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 method

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 method

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 method

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