class validator

internal  
 

Wrapper utilities around the Respect/Validation library.

Provides a small facade to simplify validation calls across the plugin while keeping a consistent API.

Methods

static bool
is_email(string $email)

Validates whether a string is a valid email address.

static bool
validate_cpf(string $cpf)

Validates whether a string is a valid Brazilian CPF number.

static bool
validate_cnpj(string $cnpj)

Validates whether a string is a valid Brazilian CNPJ number.

static bool
is_not_empty(string $value, int $minLength = 1, int|null $maxLength = null)

Checks if a string is not empty and meets min/max length constraints (max is optional).

static array
validate(mixed $data, Validatable $rules)

Generic method to validate data against multiple rules and return error messages.

static bool
is_uuid(mixed $value)

Validates whether the provided value is a valid UUID.

Details

at line 41
static bool is_email(string $email)

Validates whether a string is a valid email address.

Parameters

string $email

email to validate

Return Value

bool

True if valid, false otherwise

at line 53
static bool validate_cpf(string $cpf)

Validates whether a string is a valid Brazilian CPF number.

Parameters

string $cpf

CPF to validate (masked or unmasked)

Return Value

bool

True if valid, false otherwise

at line 65
static bool validate_cnpj(string $cnpj)

Validates whether a string is a valid Brazilian CNPJ number.

Parameters

string $cnpj

CNPJ to validate (masked or unmasked)

Return Value

bool

True if valid, false otherwise

at line 79
static bool is_not_empty(string $value, int $minLength = 1, int|null $maxLength = null)

Checks if a string is not empty and meets min/max length constraints (max is optional).

Parameters

string $value

value to validate

int $minLength

minimum length (default: 1)

int|null $maxLength

optional maximum length

Return Value

bool

True if valid

at line 92
static array validate(mixed $data, Validatable $rules)

Generic method to validate data against multiple rules and return error messages.

Parameters

mixed $data

data to validate

Validatable $rules

the validation rules chain

Return Value

array

an array of error messages; empty array means validation passed

at line 110
static bool is_uuid(mixed $value)

Validates whether the provided value is a valid UUID.

Parameters

mixed $value

the value to be checked for UUID format

Return Value

bool

returns true if the value is a valid UUID, otherwise false