API reference / Quittio \ Core \ View \ Model
ViewList
final class in quittio/core · extends ViewNode
Quittio\Core\View\Model\ViewList · Source
A list (or a map, such as "labels") of the view model whose entries have one type, e.g. ViewList<LineView> for "lines" or ViewList<string> for "legalNotes".
It behaves like every other node: loop over it, read entries with $list[0], count() it, call isEmpty() or toArray(). Entries are recorded for the mandatory field guard as the template reads them.
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() | |
->count() | |
->getIterator() | Entries are read (and recorded) one by one while the template loops over them. |
->isEmpty() | |
->jsonSerialize() | |
->offsetExists() | |
->offsetGet() | The entry at $offset; null when it is missing. |
->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 = '',
)| Parameter | Type | Description |
|---|---|---|
$data | array<string|int, mixed> | |
$log | AccessLog | |
$path | string = '' |
__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
count()#
public function count(): int- Returns
int
getIterator()#
public function getIterator(): Traversable<string|int, T>Entries are read (and recorded) one by one while the template loops over them.
- Returns
Traversable<string|int, Quittio\Core\View\Model\T>
isEmpty()#
public function isEmpty(): bool- Returns
bool
jsonSerialize()#
public function jsonSerialize(): mixed- Returns
mixed
offsetExists()#
public function offsetExists(mixed $offset): bool| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
- Returns
bool
offsetGet()#
public function offsetGet(mixed $offset): T|nullThe entry at $offset; null when it is missing.
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
- Returns
Quittio\Core\View\Model\T|null
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
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>