CRUDUI PHP API

MeasuredRule extends ParameterRule
in package

AbstractYes

A rule on a measure of the value (its number, its length or its count): a value without a measure fails, and the rule decides for a measure.

Tags
template
extends

Table of Contents

Methods

validate()  : bool
Validate a value against the checked parameter of the rule.
accepts()  : bool
Whether the measure is accepted under the parameter.
holds()  : bool
Whether the value holds under the checked parameter.
measure()  : int|float|null
The measure of the value, or null for a value without one.
parameter()  : P
The checked parameter of the rule.
within()  : bool
Whether the measure lies within the inclusive range.

Methods

validate()

Validate a value against the checked parameter of the rule.

public final validate(mixed $value, mixed $param, array<string|int, mixed> $allData, FieldPath $path) : bool
Parameters
$value : mixed

The value to validate

$param : mixed

The rule parameter (e.g., min length, pattern, etc.)

$allData : array<string|int, mixed>

All form data (for cross-field validation)

$path : FieldPath

The data path of the value with the positions of its row keys

Tags
throws
InvalidRuleParameter

when the parameter is outside the validation rules

Return values
bool —

True if valid, false otherwise

accepts()

Whether the measure is accepted under the parameter.

protected abstract accepts(int|float $measure, P $parameter) : bool
Parameters
$measure : int|float
$parameter : P
Return values
bool

holds()

Whether the value holds under the checked parameter.

protected final holds(mixed $value, P $parameter) : bool
Parameters
$value : mixed
$parameter : P
Return values
bool

measure()

The measure of the value, or null for a value without one.

protected abstract measure(mixed $value) : int|float|null
Parameters
$value : mixed
Return values
int|float|null

parameter()

The checked parameter of the rule.

protected abstract parameter(mixed $param) : P
Parameters
$param : mixed
Tags
throws
InvalidRuleParameter

when the parameter is outside the validation rules

Return values
P

within()

Whether the measure lies within the inclusive range.

protected final static within(int|float $measure, array{int|float, int|float} $range) : bool
Parameters
$measure : int|float
$range : array{int|float, int|float}

the minimum and the maximum

Return values
bool
On this page

Search results