# HistoryPanelDifferenceCounts

> Immutable JSON-leaf difference counts for one captured panel.

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Comparison](/docs/extensions/yii3-debug/reference/comparison/index.md) › HistoryPanelDifferenceCounts

| final readonly class | `Yii3\Debug\Comparison\HistoryPanelDifferenceCounts` |
| --- | --- |
| Source | [`src/Comparison/HistoryPanelDifferenceCounts.php`](https://github.com/yii3/debug/blob/main/src/Comparison/HistoryPanelDifferenceCounts.php#L10) |

Immutable JSON-leaf difference counts for one captured panel.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-added"></span>`$added` readonly constructor | `int` | JSON leaves present only in the target. | `HistoryPanelDifferenceCounts` |
| <span id="property-changed"></span>`$changed` readonly constructor | `int` | JSON leaves present in both with a different value. | `HistoryPanelDifferenceCounts` |
| <span id="property-removed"></span>`$removed` readonly constructor | `int` | JSON leaves present only in the baseline. | `HistoryPanelDifferenceCounts` |
| <span id="property-unchanged"></span>`$unchanged` readonly constructor | `int` | JSON leaves identical in both. | `HistoryPanelDifferenceCounts` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates the JSON-leaf difference counts for one panel. | `HistoryPanelDifferenceCounts` |
| [`differenceCount()`](#method-differenceCount) | Returns how many leaves differ between both captures. | `HistoryPanelDifferenceCounts` |

## Method details

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

```php
public function __construct(int $added, int $removed, int $changed, int $unchanged)
```

Creates the JSON-leaf difference counts for one panel.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$added` | `int` | JSON leaves present only in the target. |
| `$removed` | `int` | JSON leaves present only in the baseline. |
| `$changed` | `int` | JSON leaves present in both with a different value. |
| `$unchanged` | `int` | JSON leaves identical in both. |

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

```php
public function differenceCount(): int
```

Returns how many leaves differ between both captures.

**Returns**

`int`: Added, removed, and changed leaves combined; unchanged ones are excluded.