Skip to content
PHP Ecosystem
Explore

ToolbarItem

API reference › Debug Core › Toolbar › ToolbarItem

final readonly classPHPForge\Debug\Toolbar\ToolbarItem
ImplementsJsonSerializable
Sourcesrc/Toolbar/ToolbarItem.php

Represents one metric rendered inside a debug toolbar panel.

PropertyTypeDescriptionDefined by
$icon readonly constructorstring|nullShared icon name or null when the label identifies the value. Default: null.ToolbarItem
$id readonly constructorstring|nullStable semantic metric identifier or null for presentation-only metrics. Default: null.ToolbarItem
$label readonly constructorstring|nullShort metric label or null when an icon identifies the value. Default: null.ToolbarItem
$status readonly constructorstringSemantic badge status. Default: 'default'.ToolbarItem
$title readonly constructorstring|nullTooltip text or null when no tooltip is needed. Default: null.ToolbarItem
$url readonly constructorstring|nullDebug page URL or null when the metric is not navigable. Default: null.ToolbarItem
$value readonly constructorstringMetric value shown in the toolbar.ToolbarItem
MethodDescriptionDefined by
create() staticCreates 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
public static function create(string $value): self

Creates a metric with default presentation options.

Parameters

ParameterTypeDescription
$valuestring

Returns

self

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.

public function withIcon(string|null $icon): self

Returns a copy with the specified icon.

Parameters

ParameterTypeDescription
$iconstring|null

Returns

self

public function withId(string|null $id): self

Returns a copy with the specified metric ID.

Parameters

ParameterTypeDescription
$idstring|null

Returns

self

public function withLabel(string|null $label): self

Returns a copy with the specified label.

Parameters

ParameterTypeDescription
$labelstring|null

Returns

self

public function withStatus(string $status): self

Returns a copy with the specified status.

Parameters

ParameterTypeDescription
$statusstring

Returns

self

public function withTitle(string|null $title): self

Returns a copy with the specified title.

Parameters

ParameterTypeDescription
$titlestring|null

Returns

self

public function withUrl(string|null $url): self

Returns a copy with the specified URL.

Parameters

ParameterTypeDescription
$urlstring|null

Returns

self