# SummaryMetricComparison

> Calculates and formats request-summary metrics without depending on adapter presentation models.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Comparison](/docs/extensions/debug-core/reference/comparison/index.md) › SummaryMetricComparison

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

Calculates and formats request-summary metrics without depending on adapter presentation models.

Results retain the history labels, order, units, trends, and related panel IDs used by both adapters.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-baseline"></span>`$baseline` readonly constructor | `string` | Formatted baseline value. | `SummaryMetricComparison` |
| <span id="property-delta"></span>`$delta` readonly constructor | `string` | Formatted difference, or `No change` when both values match. | `SummaryMetricComparison` |
| <span id="property-label"></span>`$label` readonly constructor | `string` | History metric label. | `SummaryMetricComparison` |
| <span id="property-panelId"></span>`$panelId` readonly constructor | `string\|null` | Related panel ID, or `null` when the metric has no panel. Default: `null`. | `SummaryMetricComparison` |
| <span id="property-target"></span>`$target` readonly constructor | `string` | Formatted target value. | `SummaryMetricComparison` |
| <span id="property-trend"></span>`$trend` readonly constructor | `string` | Trend direction: `up`, `down`, or `neutral`. | `SummaryMetricComparison` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`between()`](#method-between) static | Compares summaries in the canonical history metric order. | `SummaryMetricComparison` |
| [`hasDifference()`](#method-hasDifference) | Returns whether the metric changed between the baseline and the target. | `SummaryMetricComparison` |

## Method details

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

```php
public static function between(PHPForge\Debug\Storage\RequestSummary $baseline, PHPForge\Debug\Storage\RequestSummary $target): list<self>
```

Compares summaries in the canonical history metric order.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$baseline` | [`PHPForge\Debug\Storage\RequestSummary`](/docs/extensions/debug-core/reference/storage/requestsummary/index.md) | Baseline request metadata. |
| `$target` | [`PHPForge\Debug\Storage\RequestSummary`](/docs/extensions/debug-core/reference/storage/requestsummary/index.md) | Target request metadata. |

**Returns**

`list<self>`: Metric comparisons in canonical history order.

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

```php
public function hasDifference(): bool
```

Returns whether the metric changed between the baseline and the target.

**Returns**

`bool`: `true` when the formatted delta reports a change; `false` otherwise.