Skip to content

Effect

One entry in a request’s effect ledger: a single observed side effect (a query, an HTTP call, a cache read, …), recorded in the order it happened.

$fingerprint is what LedgerMatcher matches a replayed call against first — normalized SQL plus a hash of bound parameters for a database call, method+URI+body-hash for HTTP, the key for a cache read — falling back to $seq position within the same EffectKind when no fingerprint matches. $call carries whatever a given recorder needs to describe the call beyond the fingerprint (e.g. the raw SQL and bound parameters), and $result the value playback answers with on a match.

final readonly class Effect

SourceCassette/Effect.php
PropertyTypeDescription
$callarrayreadonly.
$durationMicros?``intreadonly.
$fingerprintstringreadonly.
$kindEffectKindreadonly.
$resultmixedreadonly.
$seqintreadonly.

public function __construct(non-negative-int $seq, EffectKind $kind, string $fingerprint, array<string, mixed> $call, mixed $result, non-negative-int|null $durationMicros = null): mixed

Wall time the real call took, when known.

ParameterTypeDescription
$seqnon-negative-intPosition in the ledger, in recorded order.
$kindEffectKind
$fingerprintstring
$callarray``<``string``, ``mixed``>Recorder-specific description of the call.
$resultmixed
$durationMicros`non-negative-int““null`

Returns mixed