Zum Inhalt springen

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#

MethodDescription
->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): bool

Whether $path or any field below it was read.

ParameterTypeDescription
$pathstring
Returns
bool

all()#

public function all(): list<string>
Returns
list<string>

bind()#

public function bind(
    array<string|int, mixed> $data,
    array<string, string> $aliases = [],
): void

The view model data the paths refer to, for {@see self::expand()}.

ParameterTypeDescription
$dataarray<string|int, mixed>
$aliasesarray<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"].

ParameterTypeDescription
$patternstring
Returns
list<string>

hasData()#

public function hasData(): bool
Returns
bool

record()#

public function record(string $path): void
ParameterTypeDescription
$pathstring

reset()#

public function reset(): void

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.