ToolbarItem
API reference › Debug Core › Toolbar › ToolbarItem
Represents one metric rendered inside a debug toolbar panel.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$icon readonly constructor | string| | Shared icon name or null when the label identifies the value. Default: null. | ToolbarItem |
$id readonly constructor | string| | Stable semantic metric identifier or null for presentation-only metrics. Default: null. | ToolbarItem |
$label readonly constructor | string| | Short metric label or null when an icon identifies the value. Default: null. | ToolbarItem |
$status readonly constructor | string | Semantic badge status. Default: 'default'. | ToolbarItem |
$title readonly constructor | string| | Tooltip text or null when no tooltip is needed. Default: null. | ToolbarItem |
$url readonly constructor | string| | Debug page URL or null when the metric is not navigable. Default: null. | ToolbarItem |
$value readonly constructor | string | Metric value shown in the toolbar. | ToolbarItem |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
create() static | Creates a metric with default presentation options. | ToolbarItem |
jsonSerialize() | Returns the metric payload consumed by the toolbar runtime. | ToolbarItem |
withIcon() | Returns a copy with the specified icon. | ToolbarItem |
withId() | Returns a copy with the specified metric ID. | ToolbarItem |
withLabel() | Returns a copy with the specified label. | ToolbarItem |
withStatus() | Returns a copy with the specified status. | ToolbarItem |
withTitle() | Returns a copy with the specified title. | ToolbarItem |
withUrl() | Returns a copy with the specified URL. | ToolbarItem |
Method details
Section titled “Method details”create()
Section titled “create() ”public static function create(string $value): selfCreates a metric with default presentation options.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string |
Returns
self
jsonSerialize()
Section titled “jsonSerialize() ”public function jsonSerialize(): array{value: string, status: string, label?: string, icon?: string, title?: string, url?: string, id?: string}Returns the metric payload consumed by the toolbar runtime.
Returns
array{value: string, status: string, label?: string, icon?: string, title?: string, url?: string, id?: string}: Serialized metric payload.
withIcon()
Section titled “withIcon() ”public function withIcon(string|null $icon): selfReturns a copy with the specified icon.
Parameters
| Parameter | Type | Description |
|---|---|---|
$icon | string| |
Returns
self
withId()
Section titled “withId() ”public function withId(string|null $id): selfReturns a copy with the specified metric ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
$id | string| |
Returns
self
withLabel()
Section titled “withLabel() ”public function withLabel(string|null $label): selfReturns a copy with the specified label.
Parameters
| Parameter | Type | Description |
|---|---|---|
$label | string| |
Returns
self
withStatus()
Section titled “withStatus() ”public function withStatus(string $status): selfReturns a copy with the specified status.
Parameters
| Parameter | Type | Description |
|---|---|---|
$status | string |
Returns
self
withTitle()
Section titled “withTitle() ”public function withTitle(string|null $title): selfReturns a copy with the specified title.
Parameters
| Parameter | Type | Description |
|---|---|---|
$title | string| |
Returns
self
withUrl()
Section titled “withUrl() ”public function withUrl(string|null $url): selfReturns a copy with the specified URL.
Parameters
| Parameter | Type | Description |
|---|---|---|
$url | string| |
Returns
self