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
Properties#
| Property | Type | Description |
|---|---|---|
$data protected | array<string|int, mixed> | from ViewNode |
$log protected | AccessLog | from ViewNode |
$path protected | string | from ViewNode |
Methods#
| Method | Description |
|---|---|
->__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 = [],
)| Parameter | Type | Description |
|---|---|---|
$data | array<string, mixed> | |
$log | ?AccessLog = null | |
$aliases | array<string, string> = [] | view model nodes that stand for others, e.g. issuer => seller |
__get()#
public function __get(string $name): mixed| Parameter | Type | Description |
|---|---|---|
$name | string |
- Returns
mixed
__isset()#
public function __isset(string $name): bool| Parameter | Type | Description |
|---|---|---|
$name | string |
- Returns
bool
accessLog()#
public function accessLog(): AccessLog- Returns
AccessLog
count()#
public function count(): int- Returns
int
getIterator()#
public function getIterator(): TraversableItems 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
label()#
public function label(string $key, array<string, string> $replace = []): stringTranslated label; per invoice overrides from the presentation data win.
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$replace | array<string, string> = [] |
- Returns
string
offsetExists()#
public function offsetExists(mixed $offset): bool| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
- Returns
bool
offsetGet()#
public function offsetGet(mixed $offset): mixed| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
- Returns
mixed
offsetSet()#
public function offsetSet(mixed $offset, mixed $value): void| Parameter | Type | Description |
|---|---|---|
$offset | mixed | |
$value | mixed |
offsetUnset()#
public function offsetUnset(mixed $offset): void| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
read()#
protected function read(string|int $key): mixed| Parameter | Type | Description |
|---|---|---|
$key | string|int |
- Returns
mixed
title()#
public function title(): stringDocument title (e.g. "Invoice", "Credit note") for PDF metadata and file names.
- Returns
string
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>