AssignmentReceipt
Rasuvaeff\Yii3AbTesting\AssignmentReceipt
Class · rasuvaeff/yii3-ab-testing · Source
Proof of an exposure, small enough to travel in a cookie or session so a conversion in a later request can be attributed without resolving the assignment again (which could return a different variant after a reweight).
Deliberately carries no environment or dimensions: receipts are stored in size-capped cookies, and a conversion records the context of its own request anyway. The link back to the exposure is exposureEventId.
Constructor
php
new AssignmentReceipt(
string $exposureEventId,
DateTimeImmutable $occurredAt,
string $experiment,
string $variant,
string $subjectId,
DecisionReason $reason,
AssignmentSource $source,
?string $experimentRevision = null,
)Properties
| Property | Type | Readonly | Description |
|---|---|---|---|
exposureEventId | string | yes | |
occurredAt | DateTimeImmutable | yes | |
experiment | string | yes | |
variant | string | yes | |
subjectId | string | yes | |
experimentRevision | ?string | yes | |
reason | DecisionReason | yes | |
source | AssignmentSource | yes |
Methods
toArray()
php
toArray(): arrayfromArray()
php
static fromArray(array $data): selfRebuilds a receipt from toArray() output.
The input is transport data — a cookie value is attacker-controlled even when signed — so every field is re-validated rather than trusted.