RequestHero
API reference › Debug Core › Panel › Request › RequestHero
Immutable Request identity with optional response, timing, and display metadata.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a request identity ready for response and display metadata. | RequestHero |
create() static | Creates 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 |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(string $method, string $url)Creates a request identity ready for response and display metadata.
Parameters
| Parameter | Type | Description |
|---|---|---|
$method | string | HTTP method of the request. |
$url | string | Full URL of the request. |
create()
Section titled “create() ”public static function create(string $method, string $url): selfCreates a hero carrying the request identity, ready for immutable enrichment.
Parameters
| Parameter | Type | Description |
|---|---|---|
$method | string | HTTP method of the request. |
$url | string | Full URL of the request. |
Returns
self: Hero carrying only the request identity.
getDurationMs()
Section titled “getDurationMs() ”public function getDurationMs(): stringReturns the processing time of the request.
Returns
string: Formatted processing time, in milliseconds; empty when it was not captured.
getFlags()
Section titled “getFlags() ”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.
getIp()
Section titled “getIp() ”public function getIp(): stringReturns the client address of the request.
Returns
string: Client address of the request; empty when it was not captured.
getMethod()
Section titled “getMethod() ”public function getMethod(): stringReturns the HTTP method of the request.
Returns
string: HTTP method of the request.
getStatusCode()
Section titled “getStatusCode() ”public function getStatusCode(): intReturns the response status code.
Returns
int: Response status code; 0 when no response was captured.
getStatusVariant()
Section titled “getStatusVariant() ”public function getStatusVariant(): stringReturns 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.
getTime()
Section titled “getTime() ”public function getTime(): stringReturns the wall-clock time of the request.
Returns
string: Formatted wall-clock time of the request; empty when it was not captured.
getUrl()
Section titled “getUrl() ”public function getUrl(): stringReturns the full URL of the request.
Returns
string: Full URL of the request.
withFlags()
Section titled “withFlags() ”public function withFlags(list<string> $flags): selfReturns a copy carrying another set of flags.
Parameters
| Parameter | Type | Description |
|---|---|---|
$flags | list<string> | Boolean flags surfaced as chips on the meta strip, in display order. |
Returns
self: Hero with the flags applied.
withIp()
Section titled “withIp() ”public function withIp(string $ip): selfReturns a copy carrying the client address.
Parameters
| Parameter | Type | Description |
|---|---|---|
$ip | string | Client address of the request; empty when it was not captured. |
Returns
self: Hero with the address applied.
withStatus()
Section titled “withStatus() ”public function withStatus(int $statusCode, string $statusVariant): selfReturns a copy carrying the captured response status.
Parameters
| Parameter | Type | Description |
|---|---|---|
$statusCode | int | Response status code; 0 when no response was captured. |
$statusVariant | string | Status-pill CSS modifier derived from the status code: '2xx' to '5xx', or 'none' when uncaptured. |
Returns
self: Hero with the status applied.
withTiming()
Section titled “withTiming() ”public function withTiming(string $time, string $durationMs): selfReturns a copy carrying the captured timing.
Parameters
| Parameter | Type | Description |
|---|---|---|
$time | string | Formatted wall-clock time of the request; empty when it was not captured. |
$durationMs | string | Formatted processing time, in milliseconds; empty when it was not captured. |
Returns
self: Hero with the timing applied.