Validation class
Framework\Validation\Validation
Class Validation.
Defined in libraries/validation/src/Validation.php
Properties #
- $labels
- The labels used to replace field names.
- $rules
- The Validator rules.
- $errors
- The last errors.
- $messages
- Custom error messages.
- $validators
- The current Validators.
- $language
- The Language instance.
- $debugCollector
- -
$labels
The labels used to replace field names.
$rules
The Validator rules.
$errors
The last errors.
$messages
Custom error messages.
$validators
The current Validators.
$language
The Language instance.
$debugCollector
Methods #
- __construct()
- Validation constructor.
- getDebugCollector()
- -
- getError()
- Get latest error for a given field.
- getErrors()
- Get latest errors.
- getFilledMessage()
- -
- getLabel()
- Get the label for a given field.
- getLabels()
- Get a list of all labels.
- getLanguage()
- -
- getMessage()
- Get the custom error message from a field rule.
- getMessages()
- Get all custom error messages set.
- getRules()
- Get a list of current rules.
- getRuleset()
- -
- getValidators()
- -
- hasError()
- -
- isRuleAvailable()
- Tells if a rule is available in the current validators.
- reset()
- Reset the validation.
- setDebugCollector()
- -
- setError()
- -
- setLabel()
- Set label for a field.
- setLabels()
- Set fields labels.
- setLanguage()
- -
- setMessage()
- Set a custom error message for a field rule.
- setMessages()
- Set many custom error messages.
- setRule()
- Set rules for a given field.
- setRules()
- Set field rules.
- validate()
- Validate data with all rules.
- validateOnly()
- Validate only fields set on data.
- escapeArgs()
- -
- extractRules()
- -
- parseRule()
- -
- replaceArgs()
- Replace argument placeholders with data values.
- run()
- -
- setEqualsField()
- -
- validateField()
- -
- validateOnlySet()
- -
- validateRule()
- -
__construct()
Validation constructor.
- ?array $validators
- ?\Framework\Language\Language $language
getDebugCollector()
getError()
Get latest error for a given field.
- string $field
getErrors()
Get latest errors.
getFilledMessage()
- string $field
- string $rule
- array $args
getLabel()
Get the label for a given field.
- string $field
getLabels()
Get a list of all labels.
getLanguage()
getMessage()
Get the custom error message from a field rule.
- string $field - The field name
- string $rule - The rule name
getMessages()
Get all custom error messages set.
getRules()
Get a list of current rules.
getRuleset()
getValidators()
hasError()
- string $field
isRuleAvailable()
Tells if a rule is available in the current validators.
- string $rule
reset()
Reset the validation.
setDebugCollector()
- \Framework\Validation\Debug\ValidationCollector $debugCollector
setError()
- string $field
- string $rule
- array $args
setLabel()
Set label for a field.
- string $field
- string $label
setLabels()
Set fields labels.
- array $labels - An associative array with fields as keys and label as values
setLanguage()
- ?\Framework\Language\Language $language
setMessage()
Set a custom error message for a field rule.
- string $field - The field name
- string $rule - The field rule name
- string $message - The custom error message for the field rule
setMessages()
Set many custom error messages.
- array $messages - A multi-dimensional array with field names as keys and values as arrays where the keys are rule names and values are the custom error message strings
setRule()
Set rules for a given field.
- string $field
- array|string $rules
setRules()
Set field rules.
- array $rules - An associative array with field as keys and values as rules
validate()
Validate data with all rules.
- array $data
validateOnly()
Validate only fields set on data.
- array $data
escapeArgs()
- array $args
extractRules()
- string $rules
parseRule()
- string $rule
replaceArgs()
Replace argument placeholders with data values.
- array $args
- array $data
run()
- array $fieldRules
- array $data
setEqualsField()
- array $rule
validateField()
- string $field
- array $rules
- array $data
validateOnlySet()
- array $data
validateRule()
- string $rule
- string $field
- array $args
- array $data