---
title: "ViewNode – API-Referenz · Quittio"
description: "Read-only node of the invoice view model with recorded property access."
canonical_url: "https://quittio.dev/docs/api/Quittio/Core/View/ViewNode"
locale: de
meta:
  "og:description": "Read-only node of the invoice view model with recorded property access."
  "og:image": "https://quittio.dev/og/quittio-de.jpg"
  "og:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "ViewNode – API-Referenz · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-de.jpg"
  "twitter:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
---

> Index of every page on this site: [llms.txt](https://quittio.dev/llms.txt)

[API reference](https://quittio.dev/docs/api) / [Quittio](https://quittio.dev/docs/api/Quittio) \\ [Core](https://quittio.dev/docs/api/Quittio/Core) \\ [View](https://quittio.dev/docs/api/Quittio/Core/View)

# ViewNode

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

`Quittio\Core\View\ViewNode` · [Source](https://github.com/Quittio/quittio/blob/v0.7.1/packages/core/src/View/ViewNode.php#L32)

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 \#

| Property | Type | Description |
| --- | --- | --- |
| `$data` protected | `array<string\|int, mixed>` | |
| `$log` protected | `[AccessLog](https://quittio.dev/docs/api/Quittio/Core/View/AccessLog)` | |
| `$path` protected | `string` | |

## Methods \#

| Method | Description |
| --- | --- |
| `->__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 = '',
)
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `array<string\|int, mixed>` | |
| `$log` | `[AccessLog](https://quittio.dev/docs/api/Quittio/Core/View/AccessLog)` | |
| `$path` | `string` = `''` | |

### `__get()`#

```
public function __get(string $name): mixed
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | |

<dl><dt>Returns</dt>
<dd><code>mixed</code></dd>
</dl>

### `__isset()`#

```
public function __isset(string $name): bool
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | |

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `count()`#

```
public function count(): int
```

<dl><dt>Returns</dt>
<dd><code>int</code></dd>
</dl>

### `getIterator()`#

```
public function getIterator(): Traversable
```

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

<dl><dt>Returns</dt>
<dd><code>Traversable</code></dd>
</dl>

### `isEmpty()`#

```
public function isEmpty(): bool
```

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `jsonSerialize()`#

```
public function jsonSerialize(): mixed
```

<dl><dt>Returns</dt>
<dd><code>mixed</code></dd>
</dl>

### `offsetExists()`#

```
public function offsetExists(mixed $offset): bool
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$offset` | `mixed` | |

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `offsetGet()`#

```
public function offsetGet(mixed $offset): mixed
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$offset` | `mixed` | |

<dl><dt>Returns</dt>
<dd><code>mixed</code></dd>
</dl>

### `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
```

protected

| Parameter | Type | Description |
| --- | --- | --- |
| `$key` | `string\|int` | |

<dl><dt>Returns</dt>
<dd><code>mixed</code></dd>
</dl>

### `toArray()`#

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

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

<dl><dt>Returns</dt>
<dd><code>array&lt;string|int, mixed&gt;</code></dd>
</dl>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://quittio.dev/#website","@type":"WebSite","description":"E-Rechnungen für PHP und Laravel: ZUGFeRD, XRechnung und Peppol erstellen, prüfen, lesen und archivieren.","inLanguage":"de-DE","name":"Quittio","url":"https://quittio.dev/","publisher":{"@id":"https://quittio.dev/#identity"},"workTranslation":{"@id":"https://quittio.dev/en#website"}},{"@id":"https://quittio.dev/docs/api/Quittio/Core/View/ViewNode#webpage","@type":"WebPage","description":"Read-only node of the invoice view model with recorded property access.","name":"ViewNode – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/View/ViewNode","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Core/View/ViewNode"]}],"primaryImageOfPage":{"@id":"https://quittio.dev/#logo"}},{"@id":"https://quittio.dev/#identity","@type":"Organization","description":"Open-Source-Bibliothek für E-Rechnungen in PHP und Laravel (ZUGFeRD, XRechnung, Peppol) und Quittio Managed.","email":"kontakt@niklasforst.de","legalName":"Niklas Forst – Softwareentwicklung","name":"Quittio","url":"https://quittio.dev","founder":{"@type":"Person","name":"Niklas Forst","url":"https://quittio.dev/ueber"},"logo":{"@id":"https://quittio.dev/#logo"},"sameAs":["https://github.com/Quittio/quittio","https://packagist.org/packages/quittio/quittio"]},{"@id":"https://quittio.dev/#logo","@type":"ImageObject","caption":"Quittio","contentUrl":"https://quittio.dev/logo.png","inLanguage":"de-DE","url":"https://quittio.dev/logo.png"}]}
```