Skip to content
PHP Ecosystem
Explore

PayloadDifference

API reference › Debug Core › Comparison › PayloadDifference

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

Counts structural payload differences without retaining diagnostic values or their fingerprints.

PropertyTypeDescriptionDefined by
$added readonly constructorintLeaves present only in the target payload.PayloadDifference
$changed readonly constructorintLeaves present in both payloads under a different value.PayloadDifference
$removed readonly constructorintLeaves present only in the baseline payload.PayloadDifference
$unchanged readonly constructorintLeaves present in both payloads under the same value.PayloadDifference
MethodDescriptionDefined by
between() staticCompares typed leaves at escaped paths, treating an empty array as a leaf and null as an absent payload.PayloadDifference
public static function between(array<string, mixed>|null $baseline, array<string, mixed>|null $target): self

Compares typed leaves at escaped paths, treating an empty array as a leaf and null as an absent payload.

Parameters

ParameterTypeDescription
$baselinearray<string, mixed>|nullBaseline payload, or null when not captured.
$targetarray<string, mixed>|nullTarget payload, or null when not captured.

Returns

self: Structural difference counts for the two payloads.