CRUDUI PHP API

Pattern
in package
implements RuleInterface

Whole-value pattern rule, registered as both `pattern` and `match`.

Named "Pattern" because "match" is a reserved keyword in PHP.

Table of Contents

Interfaces

RuleInterface
Interface for validation rules.

Properties

$rule  : string

Methods

__construct()  : mixed
validate()  : bool
Validate that the whole canonical text of a value matches a CRUDUI pattern.

Properties

$rule read-only

private string $rule = 'pattern'

Methods

__construct()

public __construct([string $rule = 'pattern' ]) : mixed
Parameters
$rule : string = 'pattern'

the registered name, pattern or match, used in parameter failures

validate()

Validate that the whole canonical text of a value matches a CRUDUI pattern.

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

An array or object value fails.

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 not a pattern in the language

Return values
bool —

True if valid, false otherwise

On this page

Search results