API reference / Quittio \ Core \ View
AccessLog
final class in quittio/core
Quittio\Core\View\AccessLog · Source
Records which view model fields a template read (for the mandatory field guard).
Only leaf values that are not null (scalars, formatted values) are recorded, so counting
or iterating a list does not count as printing it. Paths may contain "[*]": for
self::accessed() it matches any list index, self::expand() lists every index.
Aliases map one view model node onto another, e.g. "issuer" onto "seller": a template that prints $invoice->issuer->address has printed the seller's address.
Methods#
| Method | Description |
|---|---|
->accessed() | Whether $path or any field below it was read. |
->all() | |
->bind() | The view model data the paths refer to, for {@see self::expand()}. |
->expand() | The concrete paths of $pattern that hold a value (not null, not an empty list) in the bound data; "[*]" expands to every index, e.g. "vatRows[*].amount" to ["vatRows[0].amount", "vatRows[1].amount"]. |
->hasData() | |
->record() | |
->reset() |
accessed()#
public function accessed(string $path): boolWhether $path or any field below it was read.
| Parameter | Type | Description |
|---|---|---|
$path | string |
- Returns
bool
all()#
public function all(): list<string>- Returns
list<string>
bind()#
public function bind(
array<string|int, mixed> $data,
array<string, string> $aliases = [],
): voidThe view model data the paths refer to, for {@see self::expand()}.
| Parameter | Type | Description |
|---|---|---|
$data | array<string|int, mixed> | |
$aliases | array<string, string> = [] | path prefix => path prefix it stands for |
expand()#
public function expand(string $pattern): list<string>The concrete paths of $pattern that hold a value (not null, not an empty list) in the bound data; "[*]" expands to every index, e.g. "vatRows[*].amount" to ["vatRows[0].amount", "vatRows[1].amount"].
| Parameter | Type | Description |
|---|---|---|
$pattern | string |
- Returns
list<string>
hasData()#
public function hasData(): bool- Returns
bool
record()#
public function record(string $path): void| Parameter | Type | Description |
|---|---|---|
$path | string |
reset()#
public function reset(): void