Zum Inhalt springen

API reference / Quittio \ Core \ View

ViewNode

class in quittio/core · implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable

Quittio\Core\View\ViewNode · Source

Read-only node of the invoice view model with recorded property access.

Templates use object syntax ($invoice->seller->name). Every read of a leaf value that is not null (scalar or formatted value) is recorded in the access log, so that the mandatory field guard can tell which values a custom template printed. A value counts as printed when it is read as a leaf: also in a condition such as if ($invoice->buyer->vatId) and while a loop reads the items of a list. Counting a list (count(), isEmpty(), isset()) and reading null values are not recorded: count($invoice->legalNotes) prints no note.

Nested nodes are typed: $invoice->seller is a Model\PartyView, $invoice->lines a Model\ViewList of Model\LineView. The typed nodes are ViewNodes whose keys are documented as typed properties, so they read, loop, count and record exactly like this class.

Properties#

PropertyTypeDescription
$data protectedarray<string|int, mixed>
$log protectedAccessLog
$path protectedstring

Methods#

MethodDescription
->__construct()
->__get()
->__isset()
->count()
->getIterator()Items are read (and recorded) one by one while the template loops over them.
->isEmpty()
->jsonSerialize()
->offsetExists()
->offsetGet()
->offsetSet()
->offsetUnset()
->read()
->toArray()Plain values, e.g. for implode(); counts as reading every value below this node.

__construct()#

public function __construct(
    array<string|int, mixed> $data,
    AccessLog $log,
    string $path = '',
)
ParameterTypeDescription
$dataarray<string|int, mixed>
$logAccessLog
$pathstring = ''

__get()#

public function __get(string $name): mixed
ParameterTypeDescription
$namestring
Returns
mixed

__isset()#

public function __isset(string $name): bool
ParameterTypeDescription
$namestring
Returns
bool

count()#

public function count(): int
Returns
int

getIterator()#

public function getIterator(): Traversable

Items are read (and recorded) one by one while the template loops over them.

Returns
Traversable

isEmpty()#

public function isEmpty(): bool
Returns
bool

jsonSerialize()#

public function jsonSerialize(): mixed
Returns
mixed

offsetExists()#

public function offsetExists(mixed $offset): bool
ParameterTypeDescription
$offsetmixed
Returns
bool

offsetGet()#

public function offsetGet(mixed $offset): mixed
ParameterTypeDescription
$offsetmixed
Returns
mixed

offsetSet()#

public function offsetSet(mixed $offset, mixed $value): void
ParameterTypeDescription
$offsetmixed
$valuemixed

offsetUnset()#

public function offsetUnset(mixed $offset): void
ParameterTypeDescription
$offsetmixed

read()#

protected function read(string|int $key): mixed

protected

ParameterTypeDescription
$keystring|int
Returns
mixed

toArray()#

public function toArray(): array<string|int, mixed>

Plain values, e.g. for implode(); counts as reading every value below this node.

Returns
array<string|int, mixed>

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