Skip to content
PHP Ecosystem
Explore

PanelComparison

API reference › Debug Core › Comparison › PanelComparison

final readonly classPHPForge\Debug\Comparison\PanelComparison
Sourcesrc/Comparison/PanelComparison.php

Compares observed panels in configured order, combining structural differences with capture-state transitions.

Results retain only identity, labels, states, and counts; source diagnostics are neither copied nor redacted.

PropertyTypeDescriptionDefined by
$added readonly constructorintLeaves present only in the target payload.PanelComparison
$baselineState readonly constructorstringCapture state in the baseline snapshot.PanelComparison
$changed readonly constructorintLeaves that differ, or 1 for a state-only transition.PanelComparison
$id readonly constructorstringStable panel ID.PanelComparison
$label readonly constructorstringDisplay name, falling back to the panel ID.PanelComparison
$removed readonly constructorintLeaves present only in the baseline payload.PanelComparison
$targetState readonly constructorstringCapture state in the target snapshot.PanelComparison
$unchanged readonly constructorintLeaves present in both payloads under the same value.PanelComparison
MethodDescriptionDefined by
between() staticCompares the union of payload and failure IDs, with observed configured IDs first and sorted extras last.PanelComparison
differenceCount()Returns the total number of structural differences detected for the panel.PanelComparison
ConstantValueDescriptionDefined by
STATE_CAPTURED'Captured'Capture state of a panel whose payload reached the snapshot.PanelComparison
STATE_FAILED'Failed'Capture state of a panel whose capture failed.PanelComparison
STATE_NOT_CAPTURED'Not captured'Capture state of a panel absent from the snapshot.PanelComparison
public static function between(PHPForge\Debug\Storage\DebugSnapshot $baseline, PHPForge\Debug\Storage\DebugSnapshot $target, array<string, string> $panelLabels = []): list<self>

Compares the union of payload and failure IDs, with observed configured IDs first and sorted extras last.

Failures take precedence over payloads. A state transition adds one change only when there are no structural additions, removals, or changes; unchanged leaves remain counted even for that state-only transition.

Parameters

ParameterTypeDescription
$baselinePHPForge\Debug\Storage\DebugSnapshotBaseline snapshot.
$targetPHPForge\Debug\Storage\DebugSnapshotTarget snapshot.
$panelLabelsarray<string, string>Display names indexed by stable panel ID, in display order.

Returns

list<self>: Panel comparisons in configured display order.

public function differenceCount(): int

Returns the total number of structural differences detected for the panel.

Returns

int: Sum of added, removed, and changed leaves.