# TimelineSnapshot

> Canonical timing and peak-memory snapshot for the Timeline panel.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Timeline](/docs/extensions/debug-core/reference/panel/timeline/index.md) › TimelineSnapshot

| final readonly class | `PHPForge\Debug\Panel\Timeline\TimelineSnapshot` |
| --- | --- |
| Implements | [`PHPForge\Debug\Storage\PanelSnapshot`](/docs/extensions/debug-core/reference/storage/panelsnapshot/index.md) |
| Source | [`src/Panel/Timeline/TimelineSnapshot.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Timeline/TimelineSnapshot.php#L12) |

Canonical timing and peak-memory snapshot for the Timeline panel.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-end"></span>`$end` readonly constructor | `float` | The end time of the timeline snapshot. | `TimelineSnapshot` |
| <span id="property-memory"></span>`$memory` readonly constructor | `int` | The peak memory usage at the time of the snapshot. | `TimelineSnapshot` |
| <span id="property-start"></span>`$start` readonly constructor | `float` | The start time of the timeline snapshot. | `TimelineSnapshot` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates the timing and peak-memory snapshot for the request. | `TimelineSnapshot` |
| [`fromArray()`](#method-fromArray) static | Hydrates the Timeline panel snapshot from decoded JSON data. | `TimelineSnapshot` |
| [`jsonSerialize()`](#method-jsonSerialize) | Returns the snapshot for JSON serialization. | `TimelineSnapshot` |

## Method details

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

```php
public function __construct(float $start, float $end, int $memory)
```

Creates the timing and peak-memory snapshot for the request.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$start` | `float` | The start time of the timeline snapshot. |
| `$end` | `float` | The end time of the timeline snapshot. |
| `$memory` | `int` | The peak memory usage at the time of the snapshot. |

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

```php
public static function fromArray(mixed $data, string $path): self
```

Hydrates the Timeline panel snapshot from decoded JSON data.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `mixed` | Decoded Timeline panel payload. |
| `$path` | `string` | Payload path used in hydration errors. |

**Returns**

`self`: Hydrated timing and peak-memory snapshot.

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

```php
public function jsonSerialize(): array<string, mixed>
```

Returns the snapshot for JSON serialization.

**Returns**

`array<string, mixed>`: Serialized start time, end time, and peak memory.