CRUDUI PHP API

History
in package

FinalYes

The undo history rules of form instances (CURT-062, CURT-063, CURT-076 to CURT-080), as pure functions. A history is an object with the lists `entries` and `redoEntries` and, after a value edit, the string `lastPath`; no function changes its argument.

Table of Contents

Constants

LIMIT  : mixed = 100
The number of records a history keeps in each direction.

Methods

canRedo()  : bool
Whether the history has a record to restore in the forward direction.
canUndo()  : bool
Whether the history has a record to restore.
empty()  : stdClass
The history with no record.
record()  : stdClass
The history after a change from `$previous`: the record is appended unless `$path` equals the path of the last value edit, the last 100 entries stay, the redo entries are cleared and `$path` becomes the last path.
redo()  : stdClass
The history with `$current` appended to the entries and without its last redo entry, and that redo entry as the record.
undo()  : stdClass
The history without its last entry, with `$current` appended to the redo entries, and the last entry as the record.
last()  : array<int, mixed>
list()  : array<int, mixed>

Constants

LIMIT

The number of records a history keeps in each direction.

public mixed LIMIT = 100

Methods

canRedo()

Whether the history has a record to restore in the forward direction.

public static canRedo(stdClass $history) : bool
Parameters
$history : stdClass
Return values
bool

canUndo()

Whether the history has a record to restore.

public static canUndo(stdClass $history) : bool
Parameters
$history : stdClass
Return values
bool

empty()

The history with no record.

public static empty() : stdClass
Return values
stdClass

record()

The history after a change from `$previous`: the record is appended unless `$path` equals the path of the last value edit, the last 100 entries stay, the redo entries are cleared and `$path` becomes the last path.

public static record(stdClass $history, mixed $previous[, string|null $path = null ]) : stdClass
Parameters
$history : stdClass
$previous : mixed
$path : string|null = null
Return values
stdClass

redo()

The history with `$current` appended to the entries and without its last redo entry, and that redo entry as the record.

public static redo(stdClass $history, mixed $current) : stdClass
Parameters
$history : stdClass
$current : mixed
Tags
throws
FormError

when the history has no redo entry

Return values
stdClass

undo()

The history without its last entry, with `$current` appended to the redo entries, and the last entry as the record.

public static undo(stdClass $history, mixed $current) : stdClass
Parameters
$history : stdClass
$current : mixed
Tags
throws
FormError

when the history has no entry

Return values
stdClass

last()

private static last(array<int, mixed> $records) : array<int, mixed>
Parameters
$records : array<int, mixed>
Return values
array<int, mixed>

list()

private static list(stdClass $history, string $name) : array<int, mixed>
Parameters
$history : stdClass
$name : string
Return values
array<int, mixed>
On this page

Search results