# QueueSnapshot

> Canonical Queue panel snapshot holding the captured job events in their typed form.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Queue](/docs/extensions/debug-core/reference/panel/queue/index.md) › QueueSnapshot

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

Canonical Queue panel snapshot holding the captured job events in their typed form.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a queue snapshot from captured job events. | `QueueSnapshot` |
| [`capture()`](#method-capture) static | Narrows the captured queue-event payloads into typed records. | `QueueSnapshot` |
| [`entries()`](#method-entries) | Returns the captured queue lifecycle events. | `QueueSnapshot` |
| [`fromArray()`](#method-fromArray) static | Narrows the persisted queue payload into a typed snapshot. | `QueueSnapshot` |
| [`jsonSerialize()`](#method-jsonSerialize) | Returns the panel snapshot for JSON serialization. | `QueueSnapshot` |

## Method details

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

```php
public function __construct(list<PHPForge\Debug\Panel\Queue\JobRecord> $entries)
```

Creates a queue snapshot from captured job events.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$entries` | `list<`[`JobRecord`](/docs/extensions/debug-core/reference/panel/queue/jobrecord/index.md)`>` |  |

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

```php
public static function capture(array<array-key, mixed> $records): self
```

Narrows the captured queue-event payloads into typed records.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$records` | `array<array-key, mixed>` | Captured payloads in event order; non-array entries are dropped. |

**Returns**

`self`

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

```php
public function entries(): list<PHPForge\Debug\Panel\Queue\JobRecord>
```

Returns the captured queue lifecycle events.

**Returns**

`list<`[`JobRecord`](/docs/extensions/debug-core/reference/panel/queue/jobrecord/index.md)`>`: Captured job events in event order.

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

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

Narrows the persisted queue payload into a typed snapshot.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `mixed` | Persisted payload, expected to be an object carrying an `entries` list. |
| `$path` | `string` | JSON path of the payload, used to report a malformed capture. |

**Returns**

`self`: Snapshot carrying the persisted job events.

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

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

Returns the panel snapshot for JSON serialization.

**Returns**

`array<string, mixed>`