\Omega\Validation\Rule RequiredRule

Required rule class.

The RequiredRule class is responsible for validating whether a given input field is required and not empty. It checks if the input is empty and returns true if it's not, indicating that the input is valid.

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.