PHP Class Fuel\Validation\Result

Since: 2.0
Author: Fuel Development Team
Inheritance: implements Fuel\Validation\ResultInterface
Mostra file Open project: fuelphp/validation Class Usage Examples

Protected Properties

Property Type Description
$errors string[] Contains an array of errors that occurred during validation
$failedRules Fuel\Validation\RuleInterface[] Contains the rule that caused a given field to fail
$result boolean Boolean flag to indicate overall failure or success
$validated string[] Contains a list of fields that passed validation

Public Methods

Method Description
getError ( string $field ) : string
getErrors ( ) : string[]
getFailedRules ( ) : Fuel\Validation\RuleInterface[] Returns a list of rules that caused fields to fail, indexed by the field name.
getValidated ( ) : string[]
isValid ( ) : boolean
merge ( Fuel\Validation\ResultInterface $resultInterface, $fieldPrefix = '' )
setError ( string $field, string $message, string $rule ) Sets the error message for the given field
setResult ( boolean $isValid )
setValidated ( string $field )

Method Details

getError() public method

Since: 2.0
public getError ( string $field ) : string
$field string
return string

getErrors() public method

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

Since: 2.0
public getValidated ( ) : string[]
return string[]

isValid() public method

Since: 2.0
public isValid ( ) : boolean
return boolean

merge() public method

public merge ( Fuel\Validation\ResultInterface $resultInterface, $fieldPrefix = '' )
$resultInterface Fuel\Validation\ResultInterface

setError() public method

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

setResult() public method

Since: 2.0
public setResult ( boolean $isValid )
$isValid boolean

setValidated() public method

Since: 2.0
public setValidated ( string $field )
$field string

Property Details

$errors protected_oe property

Contains an array of errors that occurred during validation
protected string[] $errors
return string[]

$failedRules protected_oe property

Contains the rule that caused a given field to fail
protected RuleInterface[],Fuel\Validation $failedRules
return Fuel\Validation\RuleInterface[]

$result protected_oe property

Boolean flag to indicate overall failure or success
protected bool $result
return boolean

$validated protected_oe property

Contains a list of fields that passed validation
protected string[] $validated
return string[]