Skip to content
PHP Ecosystem
Explore

RequestHero

API reference › Debug Core › Panel › Request › RequestHero

final classPHPForge\Debug\Panel\Request\RequestHero
Sourcesrc/Panel/Request/RequestHero.php

Immutable Request identity with optional response, timing, and display metadata.

MethodDescriptionDefined by
__construct()Creates a request identity ready for response and display metadata.RequestHero
create() staticCreates a hero carrying the request identity, ready for immutable enrichment.RequestHero
getDurationMs()Returns the processing time of the request.RequestHero
getFlags()Returns the flags shown on the meta strip.RequestHero
getIp()Returns the client address of the request.RequestHero
getMethod()Returns the HTTP method of the request.RequestHero
getStatusCode()Returns the response status code.RequestHero
getStatusVariant()Returns the status-pill modifier of the response.RequestHero
getTime()Returns the wall-clock time of the request.RequestHero
getUrl()Returns the full URL of the request.RequestHero
withFlags()Returns a copy carrying another set of flags.RequestHero
withIp()Returns a copy carrying the client address.RequestHero
withStatus()Returns a copy carrying the captured response status.RequestHero
withTiming()Returns a copy carrying the captured timing.RequestHero
public function __construct(string $method, string $url)

Creates a request identity ready for response and display metadata.

Parameters

ParameterTypeDescription
$methodstringHTTP method of the request.
$urlstringFull URL of the request.
public static function create(string $method, string $url): self

Creates a hero carrying the request identity, ready for immutable enrichment.

Parameters

ParameterTypeDescription
$methodstringHTTP method of the request.
$urlstringFull URL of the request.

Returns

self: Hero carrying only the request identity.

public function getDurationMs(): string

Returns the processing time of the request.

Returns

string: Formatted processing time, in milliseconds; empty when it was not captured.

public function getFlags(): list<string>

Returns the flags shown on the meta strip.

Returns

list<string>: Boolean flags surfaced as chips on the meta strip, in display order.

public function getIp(): string

Returns the client address of the request.

Returns

string: Client address of the request; empty when it was not captured.

public function getMethod(): string

Returns the HTTP method of the request.

Returns

string: HTTP method of the request.

public function getStatusCode(): int

Returns the response status code.

Returns

int: Response status code; 0 when no response was captured.

public function getStatusVariant(): string

Returns the status-pill modifier of the response.

Returns

string: Status-pill CSS modifier derived from the status code: '2xx' to '5xx', or 'none' when uncaptured.

public function getTime(): string

Returns the wall-clock time of the request.

Returns

string: Formatted wall-clock time of the request; empty when it was not captured.

public function getUrl(): string

Returns the full URL of the request.

Returns

string: Full URL of the request.

public function withFlags(list<string> $flags): self

Returns a copy carrying another set of flags.

Parameters

ParameterTypeDescription
$flagslist<string>Boolean flags surfaced as chips on the meta strip, in display order.

Returns

self: Hero with the flags applied.

public function withIp(string $ip): self

Returns a copy carrying the client address.

Parameters

ParameterTypeDescription
$ipstringClient address of the request; empty when it was not captured.

Returns

self: Hero with the address applied.

public function withStatus(int $statusCode, string $statusVariant): self

Returns a copy carrying the captured response status.

Parameters

ParameterTypeDescription
$statusCodeintResponse status code; 0 when no response was captured.
$statusVariantstringStatus-pill CSS modifier derived from the status code: '2xx' to '5xx', or 'none' when uncaptured.

Returns

self: Hero with the status applied.

public function withTiming(string $time, string $durationMs): self

Returns a copy carrying the captured timing.

Parameters

ParameterTypeDescription
$timestringFormatted wall-clock time of the request; empty when it was not captured.
$durationMsstringFormatted processing time, in milliseconds; empty when it was not captured.

Returns

self: Hero with the timing applied.