# DumpNode

> Represents one value of a dump tree: a scalar, an enum case reference, a recursion marker, or a block with entries.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Log](/docs/extensions/debug-core/reference/panel/log/index.md) › DumpNode

| final readonly class | `PHPForge\Debug\Panel\Log\DumpNode` |
| --- | --- |
| Source | [`src/Panel/Log/DumpNode.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Log/DumpNode.php#L21) |

Represents one value of a dump tree: a scalar, an enum case reference, a recursion marker, or a block with entries.

[`PrintRParser`](/docs/extensions/debug-core/reference/panel/log/printrparser/index.md) and [`PhpExportParser`](/docs/extensions/debug-core/reference/panel/log/phpexportparser/index.md) build trees from log messages; [`DumpTreeRenderer`](/docs/extensions/debug-core/reference/panel/log/dumptreerenderer/index.md) renders them.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-entries"></span>`$entries` readonly constructor | `list<`[`DumpEntry`](/docs/extensions/debug-core/reference/panel/log/dumpentry/index.md)`>` | Block entries. | `DumpNode` |
| <span id="property-kind"></span>`$kind` readonly constructor | [`DumpKind`](/docs/extensions/debug-core/reference/panel/log/dumpkind/index.md) | Kind of value represented by the node. | `DumpNode` |
| <span id="property-label"></span>`$label` readonly constructor | `string` | Class name of an object, enum, or recursive object; `''` otherwise. | `DumpNode` |
| <span id="property-text"></span>`$text` readonly constructor | `string` | Scalar text, enum case name, or free text preceding a root block header. | `DumpNode` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`block()`](#method-block) static | Creates an array, object, or enum block. | `DumpNode` |
| [`boolean()`](#method-boolean) static | Creates a boolean from its printed text. | `DumpNode` |
| [`enumCase()`](#method-enumCase) static | Creates the enum case reference that `var_export()` prints as `\Class::Case`. | `DumpNode` |
| [`float()`](#method-float) static | Creates a float from its printed text. | `DumpNode` |
| [`fromValue()`](#method-fromValue) static | Creates the tree of a context value normalized by [`LogContext::normalize()`](/docs/extensions/debug-core/reference/panel/log/logcontext/index.md#method-normalize). | `DumpNode` |
| [`integer()`](#method-integer) static | Creates an integer from its printed text. | `DumpNode` |
| [`null()`](#method-null) static | Creates a `null` from its printed text. | `DumpNode` |
| [`recursion()`](#method-recursion) static | Creates the marker `print_r()` prints instead of an array or object it is already printing. | `DumpNode` |
| [`scalar()`](#method-scalar) static | Creates an untyped `print_r()` scalar. | `DumpNode` |
| [`string()`](#method-string) static | Creates a string from its decoded value. | `DumpNode` |

## Method details

### block() <span id="method-block"></span>

```php
public static function block(PHPForge\Debug\Panel\Log\DumpKind $kind, string $label, list<PHPForge\Debug\Panel\Log\DumpEntry> $entries, string $prefix = ''): self
```

Creates an array, object, or enum block.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$kind` | [`DumpKind`](/docs/extensions/debug-core/reference/panel/log/dumpkind/index.md) |  |
| `$label` | `string` | Class name of an object or enum; `''` for an array. |
| `$entries` | `list<`[`DumpEntry`](/docs/extensions/debug-core/reference/panel/log/dumpentry/index.md)`>` | Entries in dump order. |
| `$prefix` | `string` | Free text preceding a root block header, such as `Request:`. |

**Returns**

`self`

### boolean() <span id="method-boolean"></span>

```php
public static function boolean(string $text): self
```

Creates a boolean from its printed text.

**Parameters**

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

**Returns**

`self`

### enumCase() <span id="method-enumCase"></span>

```php
public static function enumCase(string $class, string $case): self
```

Creates the enum case reference that `var_export()` prints as `\Class::Case`.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$class` | `string` | Enum class name, without the leading backslash. |
| `$case` | `string` |  |

**Returns**

`self`

### float() <span id="method-float"></span>

```php
public static function float(string $text): self
```

Creates a float from its printed text.

**Parameters**

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

**Returns**

`self`

### fromValue() <span id="method-fromValue"></span>

```php
public static function fromValue(mixed $value): self|null
```

Creates the tree of a context value normalized by [`LogContext::normalize()`](/docs/extensions/debug-core/reference/panel/log/logcontext/index.md#method-normalize).

A value that is neither an array, a scalar, nor `null` becomes an untyped scalar.

**Parameters**

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

**Returns**

`self|null`: Tree, or `null` over the [`PrintRParser`](/docs/extensions/debug-core/reference/panel/log/printrparser/index.md) depth or value bound.

### integer() <span id="method-integer"></span>

```php
public static function integer(string $text): self
```

Creates an integer from its printed text.

**Parameters**

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

**Returns**

`self`

### null() <span id="method-null"></span>

```php
public static function null(string $text): self
```

Creates a `null` from its printed text.

**Parameters**

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

**Returns**

`self`

### recursion() <span id="method-recursion"></span>

```php
public static function recursion(string $label): self
```

Creates the marker `print_r()` prints instead of an array or object it is already printing.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$label` | `string` | Class name of a recursive object; `''` for a recursive array. |

**Returns**

`self`

### scalar() <span id="method-scalar"></span>

```php
public static function scalar(string $text): self
```

Creates an untyped `print_r()` scalar.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$text` | `string` | Text as printed, continuation lines included. |

**Returns**

`self`

### string() <span id="method-string"></span>

```php
public static function string(string $value): self
```

Creates a string from its decoded value.

**Parameters**

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

**Returns**

`self`