\Omega\Validation\Rule AbstractRule

Abstract rule class.

The AbstractRule class provides a foundation for implementing custom validation rules in Omega. It implements the RuleInterface, which defines the contract for all validation rules.

Summary

Methods
Properties
Constants
validate
getMessage
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Methods

validate()

validate(array  $data, string  $field, string[]  $params) : string|bool

Validate the rule.

Parameters

array $data

Holds array of data.

string $field

Holds the name of the field being validated.

string[] $params

Holds an array of parameters (not used for this rule).

Returns

string|bool —

Returns true if validation is successful (valid integer format), or an error message if the validation fails.

getMessage()

getMessage(array  $data, string  $field, string[]  $params) : string

Get the validation error message.

Parameters

array $data

Holds an array of data.

string $field

Holds the name of the field that failed validation.

string[] $params

Holds an array of parameters (not used for this rule).

Returns

string —

Returns the error message indicating that the field should be in a valid integer format.