Interface ValidationInterface

Summary

Fully Qualified Name: CodeIgniter\Validation\ValidationInterface

Description

Expected behavior of a validator

Methods

Name Description Defined By
check() Check; runs the validation process, returning true or false determining whether or not validation was successful. ValidationInterface
getError() Returns the error for a specified $field (or empty string if not set). ValidationInterface
getErrors() Returns the array of errors that were encountered during a run() call. The array should be in the following format: ValidationInterface
hasRule() Checks to see if the rule for key $field has been set or not. ValidationInterface
reset() Resets the class to a blank slate. Should be called whenever you need to process more than one array. ValidationInterface
run() Runs the validation process, returning true/false determining whether or not validation was successful. ValidationInterface
setError() Sets the error for a specific field. Used by custom validation methods. ValidationInterface
setRules() Stores the rules that should be used to validate the items. ValidationInterface
withRequest() Takes a Request object and grabs the input data to use from its array values. ValidationInterface

Method Details

check()

Check; runs the validation process, returning true or false determining whether or not validation was successful.

Parameter Name Type Description
$value mixed Value
$rule string Rule.
$errors string[] Errors.

Returns: bool True if valid, else false.

getError()

Returns the error for a specified $field (or empty string if not set).

Parameter Name Type Description
$field string

Returns: string

getErrors()

Returns the array of errors that were encountered during a run() call. The array should be in the following format:

[

'field1' => 'error message',
'field2' => 'error message',

]

Returns: array

hasRule()

Checks to see if the rule for key $field has been set or not.

Parameter Name Type Description
$field string

Returns: bool

reset()

Resets the class to a blank slate. Should be called whenever you need to process more than one array.

Returns: \CodeIgniter\Validation\ValidationInterface

run()

Runs the validation process, returning true/false determining whether or not validation was successful.

Parameter Name Type Description
$data array The
$group string The

Returns: bool

setError()

Sets the error for a specific field. Used by custom validation methods.

Parameter Name Type Description
$alias string
$error string

Returns: \CodeIgniter\Validation\ValidationInterface

setRules()

Stores the rules that should be used to validate the items.

Parameter Name Type Description
$rules array
$messages array

Returns: \CodeIgniter\Validation\ValidationInterface

withRequest()

Takes a Request object and grabs the input data to use from its array values.

Parameter Name Type Description
$request \CodeIgniter\HTTP\RequestInterface

Returns: \CodeIgniter\Validation\ValidationInterface

Top