Skip to content

API reference / Quittio \ Core \ View

InvoiceViewModel

final class in quittio/core · extends ViewNode

Quittio\Core\View\InvoiceViewModel · Source

The only object templates receive. Every value is available formatted ($value->formatted or {{ $value }}) and raw ($value->raw).

Templates contain no calculation logic; all values are calculated beforehand.

The nodes below are typed (Quittio\Core\View\Model): IDEs and static analysis know that $invoice->seller->address->lines is a ViewList and $invoice->totals->amountDue a FormattedValue. Object and array syntax keep reading the same values.

Properties#

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

Methods#

MethodDescription
->__construct()
->__get()
->__isset()
->accessLog()
->count()
->getIterator()Items are read (and recorded) one by one while the template loops over them.
->isEmpty()
->jsonSerialize()
->label()Translated label; per invoice overrides from the presentation data win.
->offsetExists()
->offsetGet()
->offsetSet()
->offsetUnset()
->read()
->title()Document title (e.g. "Invoice", "Credit note") for PDF metadata and file names.
->toArray()Plain values, e.g. for implode(); counts as reading every value below this node.

__construct()#

public function __construct(
    array<string, mixed> $data,
    ?AccessLog $log = null,
    array<string, string> $aliases = [],
)
ParameterTypeDescription
$dataarray<string, mixed>
$log?AccessLog = null
$aliasesarray<string, string> = []view model nodes that stand for others, e.g. issuer => seller

__get()#

public function __get(string $name): mixed

inherited from ViewNode

ParameterTypeDescription
$namestring
Returns
mixed

__isset()#

public function __isset(string $name): bool

inherited from ViewNode

ParameterTypeDescription
$namestring
Returns
bool

accessLog()#

public function accessLog(): AccessLog
Returns
AccessLog

count()#

public function count(): int

inherited from ViewNode

Returns
int

getIterator()#

public function getIterator(): Traversable

inherited from ViewNode

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

Returns
Traversable

isEmpty()#

public function isEmpty(): bool

inherited from ViewNode

Returns
bool

jsonSerialize()#

public function jsonSerialize(): mixed

inherited from ViewNode

Returns
mixed

label()#

public function label(string $key, array<string, string> $replace = []): string

Translated label; per invoice overrides from the presentation data win.

ParameterTypeDescription
$keystring
$replacearray<string, string> = []
Returns
string

offsetExists()#

public function offsetExists(mixed $offset): bool

inherited from ViewNode

ParameterTypeDescription
$offsetmixed
Returns
bool

offsetGet()#

public function offsetGet(mixed $offset): mixed

inherited from ViewNode

ParameterTypeDescription
$offsetmixed
Returns
mixed

offsetSet()#

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

inherited from ViewNode

ParameterTypeDescription
$offsetmixed
$valuemixed

offsetUnset()#

public function offsetUnset(mixed $offset): void

inherited from ViewNode

ParameterTypeDescription
$offsetmixed

read()#

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

protected inherited from ViewNode

ParameterTypeDescription
$keystring|int
Returns
mixed

title()#

public function title(): string

Document title (e.g. "Invoice", "Credit note") for PDF metadata and file names.

Returns
string

toArray()#

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

inherited from ViewNode

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

Returns
array<string|int, mixed>

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.