# TimelineSpanRow

> Typed view-model for one span row in the Timeline panel chart.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Timeline](/docs/extensions/debug-core/reference/panel/timeline/index.md) › TimelineSpanRow

| final readonly class | `PHPForge\Debug\Panel\Timeline\TimelineSpanRow` |
| --- | --- |
| Source | [`src/Panel/Timeline/TimelineSpanRow.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Timeline/TimelineSpanRow.php#L18) |

Typed view-model for one span row in the Timeline panel chart.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-category"></span>`$category` readonly constructor | `string` | Span category ([`Command::query()`](/docs/api/yii/db/command/index.md#method-query), [`Application::handleRequest()`](/docs/api/yii/base/application/index.md#method-handleRequest), ...), or `''` when not captured. | `TimelineSpanRow` |
| <span id="property-cssLeft"></span>`$cssLeft` readonly constructor | `string` | Bar `left` offset on the chart, as a percentage string (for example, `12.5`) consumed by inline `style="left:<X>%"`. | `TimelineSpanRow` |
| <span id="property-cssWidth"></span>`$cssWidth` readonly constructor | `string` | Bar `width` on the chart, as a percentage string with a `0.4%` floor so single-millisecond spans stay visible. | `TimelineSpanRow` |
| <span id="property-depth"></span>`$depth` readonly constructor | `int` | Nesting depth in the call tree; the renderer indents the row by this multiplier. | `TimelineSpanRow` |
| <span id="property-duration"></span>`$duration` readonly constructor | `float` | Span duration in milliseconds. | `TimelineSpanRow` |
| <span id="property-tooltip"></span>`$tooltip` readonly constructor | `string` | Pre-formatted `<title>` tooltip text combining category/info, duration, peak memory, and memory delta. | `TimelineSpanRow` |
| <span id="property-variant"></span>`$variant` readonly constructor | `string` | CSS variant token (`app` / `db` / `view` / `cache` / `mail` / `queue` / `other`) derived from `$category`. | `TimelineSpanRow` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a span row for the Timeline chart. | `TimelineSpanRow` |
| [`from()`](#method-from) static | Builds the view row from a captured profile block and its computed chart geometry. | `TimelineSpanRow` |

## Method details

### __construct() <span id="method-__construct"></span>

```php
public function __construct(string $category, float $duration, int $depth, string $cssLeft, string $cssWidth, string $variant, string $tooltip)
```

Creates a span row for the Timeline chart.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$category` | `string` |  |
| `$duration` | `float` |  |
| `$depth` | `int` |  |
| `$cssLeft` | `string` |  |
| `$cssWidth` | `string` |  |
| `$variant` | `string` |  |
| `$tooltip` | `string` |  |

### from() <span id="method-from"></span>

```php
public static function from(PHPForge\Debug\Panel\Profile\ProfileRow $row, float $left, float $width): self
```

Builds the view row from a captured profile block and its computed chart geometry.

Derives the CSS variant and the tooltip text, and clamps the bar width to the visible floor (`0.4%`).

The indent reuses the nesting level the profiler already recorded, so the chart and the Profiling grid agree on
the call tree.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$row` | [`PHPForge\Debug\Panel\Profile\ProfileRow`](/docs/extensions/debug-core/reference/panel/profile/profilerow/index.md) | Captured profile block. |
| `$left` | `float` | Bar left offset as a percentage of the request duration. |
| `$width` | `float` | Bar width as a percentage of the request duration. |

**Returns**

`self`