AssignmentStore
Rasuvaeff\Yii3AbTesting\AssignmentStore
Interface · rasuvaeff/yii3-ab-testing · Source
Persists an assigned variant per (experiment, subject) so a subject keeps the same variant even when experiment weights or the variant set change later.
Deterministic assignment alone keeps a subject in the same variant only while weights are stable; changing them shifts bucket boundaries. A store survives that. Sticky resolution is a separate layer — the AbTesting facade stays pure. Implementations live in the web/persistence adapter packages.
Methods
get()
php
get(string $experiment, string $subjectId): ?stringReturns the stored variant for the subject in the experiment, or null when none has been stored yet.
put()
php
put(
string $experiment,
string $subjectId,
string $variant,
): void