Skip to content

ExperimentSchedule ​

Rasuvaeff\Yii3AbTestingDb\ExperimentSchedule

Class · rasuvaeff/yii3-ab-testing-db · Source

When an experiment is meant to run, as an operational fact.

Deliberately not part of the runtime projection: isActiveAt() is a planning question, and answering it during assignment would make the served variant depend on wall-clock time in a way the deterministic hash never intends. The provider still reads the enabled flag; a scheduler or an operator flips that flag based on this.

Both bounds are optional: an open start means "already begun", an open end means "runs until stopped".

Constructor ​

php
new ExperimentSchedule(
    ?DateTimeImmutable $startsAt = null,
    ?DateTimeImmutable $endsAt = null,
)

Properties ​

PropertyTypeReadonlyDescription
startsAt?DateTimeImmutableyes
endsAt?DateTimeImmutableyes

Methods ​

open() ​

php
static open(): self

isActiveAt() ​

php
isActiveAt(DateTimeImmutable $moment): bool

Whether the schedule covers the given instant. The bounds are inclusive at the start and exclusive at the end, so two back-to-back schedules never both claim the same moment.