CRUDUI PHP API

ConditionTree extends ParameterRule
in package

Condition tree: a value passes when it is a group `{all: [...]}` or `{any: [...]}`, a field comparison `{field, op, value}` or, under the parameter `judge`, a judged text `{judge}`, at most 32 levels deep (schema.md, "Condition trees"). A JSON object is a stdClass or a non-empty associative array, a list a list array. The check reads no level below the limit.

Tags
extends

Table of Contents

Constants

DEPTH  : mixed = 32
The deepest level of a condition tree; the root condition is level 1 (CUSC-075).
OPERATORS  : mixed = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', 'in', 'has']
The operators of a field comparison (CUSC-073).

Methods

judges()  : bool
Whether the parameter `$param` permits judged text; the parameter check of the rule (CUVR-068), which the load check runs as well.
validate()  : bool
Validate a value against the checked parameter of the rule.
holds()  : bool
Whether the value holds under the checked parameter.
parameter()  : P
Whether judged text is permitted: `true` permits none, `judge` permits it.
isCondition()  : bool
Whether `$node`, at `$level`, is a condition; `$judge` permits judged text.
isScalar()  : bool
Whether a value is a string, a finite number or a boolean.
isText()  : bool
Whether a value is a string that is not empty after trimming.
members()  : array<string|int, mixed>|null
The members of a JSON object, or null for any other value.

Constants

DEPTH

The deepest level of a condition tree; the root condition is level 1 (CUSC-075).

private mixed DEPTH = 32

OPERATORS

The operators of a field comparison (CUSC-073).

private mixed OPERATORS = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', 'in', 'has']

Methods

judges()

Whether the parameter `$param` permits judged text; the parameter check of the rule (CUVR-068), which the load check runs as well.

public static judges(mixed $param) : bool
Parameters
$param : mixed
Tags
throws
InvalidRuleParameter

when the parameter is neither true nor judge

Return values
bool

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

holds()

Whether the value holds under the checked parameter.

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

parameter()

Whether judged text is permitted: `true` permits none, `judge` permits it.

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

when the parameter is neither

Return values
P

isCondition()

Whether `$node`, at `$level`, is a condition; `$judge` permits judged text.

private static isCondition(mixed $node, bool $judge, int $level) : bool
Parameters
$node : mixed
$judge : bool
$level : int
Return values
bool

isScalar()

Whether a value is a string, a finite number or a boolean.

private static isScalar(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

isText()

Whether a value is a string that is not empty after trimming.

private static isText(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

members()

The members of a JSON object, or null for any other value.

private static members(mixed $node) : array<string|int, mixed>|null
Parameters
$node : mixed
Return values
array<string|int, mixed>|null
On this page

Search results