RequestSnapshot
API reference › Debug Core › Panel › Request › RequestSnapshot
Canonical Request panel snapshot.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$statusCode readonly constructor | int | HTTP status code the request completed with. | RequestSnapshot |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
capture() static | Captures the Request payload together with the status code it must agree with. | RequestSnapshot |
data() | Returns the payload restored to plain PHP values. | RequestSnapshot |
fromArray() static | Hydrates the Request panel snapshot from decoded JSON data. | RequestSnapshot |
jsonSerialize() | Returns the snapshot for JSON serialization. | RequestSnapshot |
Method details
Section titled “Method details”capture()
Section titled “capture() ”public static function capture(array<array-key, mixed> $data): selfCaptures the Request payload together with the status code it must agree with.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | array<array-key, | Raw Request payload captured for the request. |
Returns
self: Snapshot carrying the tagged payload and its status code.
Throws
PHPForge\Debug\Storage\HydrationException: When the payload carries no integerstatusCode.
data()
Section titled “data() ”public function data(): array<array-key, mixed>Returns the payload restored to plain PHP values.
Returns
array<array-key, mixed>: Payload restored to plain PHP values.
fromArray()
Section titled “fromArray() ”public static function fromArray(mixed $data, string $path): selfHydrates the Request panel snapshot from decoded JSON data.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | Decoded Request panel payload. |
$path | string | Payload path used in hydration errors. |
Returns
self: Hydrated Request panel snapshot.
Throws
PHPForge\Debug\Storage\HydrationException: When the stored status code disagrees with the one held in the payload.
jsonSerialize()
Section titled “jsonSerialize() ”public function jsonSerialize(): array<string, mixed>Returns the snapshot for JSON serialization.
Returns
array<string, mixed>: Tagged payload and the status code it agrees with.