Documentation

ScheduleSpec
in package
uses CloneWith

FinalYes

ScheduleSpec is a complete description of a set of absolute timestamps (possibly infinite) that an action should occur at.

The meaning of a ScheduleSpec depends only on its contents and never changes, except that the definition of a time zone can change over time (most commonly, when daylight saving time policy changes for an area). To create a totally self-contained ScheduleSpec, use UTC or include self::$timezoneData. For input, you can provide zero or more of: structuredCalendar, calendar, cronString, interval, and exclude_structured_calendar, and all of them will be used (the schedule will take action at the union of all of their times, minus the ones that match excludeStructuredCalendar). On input, calendar and cronString fields will be compiled into self::structuredCalendarList (and maybe interval and timezoneName), so if you Describe a schedule, you'll see only self::$structuredCalendarList, self::$intervalList, etc.

Tags
psalm-import-type

DateIntervalValue from DateInterval

see
ScheduleSpec

Table of Contents

Properties

$calendarList  : array<int, CalendarSpec>
Calendar-based specifications of times.
$cronStringList  : array<int, non-empty-string>
A cronStringList item holds a traditional cron specification as a string.
$endTime  : DateTimeInterface|null
If endTime is set, any timestamps after endTime will be skipped.
$excludeCalendarList  : array<int, CalendarSpec>
Any timestamps matching any of exclude* will be skipped.
$excludeStructuredCalendarList  : array<int, StructuredCalendarSpec>
Any timestamps matching any of exclude* will be skipped.
$intervalList  : array<int, IntervalSpec>
Interval-based specifications of times.
$jitter  : DateInterval
All timestamps will be incremented by a random value from 0 to this amount of jitter.
$startTime  : DateTimeInterface|null
If startTime is set, any timestamps before startTime will be skipped.
$structuredCalendarList  : array<int, StructuredCalendarSpec>
Calendar-based specifications of times.
$timezoneData  : string
$timezoneName  : string
Time zone to interpret all calendar-based specs in.

Methods

new()  : self
withAddedCalendar()  : self
Calendar-based specifications of times.
withAddedCronString()  : self
A traditional cron specification as a string.
withAddedExcludeCalendar()  : self
Any timestamps matching any of exclude* will be skipped.
withAddedExcludeStructuredCalendar()  : self
Any timestamps matching any of exclude* will be skipped.
withAddedInterval()  : self
Interval-based specifications of times.
withAddedStructuredCalendar()  : self
Calendar-based specifications of times.
withCalendarList()  : self
Returns a new instance with the replaced calendar list.
withCronStringList()  : self
Returns a new instance with the replaced cron string list.
withEndTime()  : self
If endTime is set, any timestamps after endTime will be skipped.
withExcludeCalendarList()  : self
Returns a new instance with the replaced exclude calendar list.
withExcludeStructuredCalendarList()  : self
Returns a new instance with the replaced exclude structured calendar list.
withIntervalList()  : self
Returns a new instance with the replaced interval list.
withJitter()  : self
All timestamps will be incremented by a random value from 0 to this amount of jitter.
withStartTime()  : self
If startTime is set, any timestamps before startTime will be skipped.
withStructuredCalendarList()  : self
Returns a new instance with the replaced structured calendar list.
withTimezoneData()  : self
withTimezoneName()  : self
Time zone to interpret all calendar-based specs in.
__construct()  : mixed

Properties

$cronStringList read-only

A cronStringList item holds a traditional cron specification as a string.

public array<int, non-empty-string> $cronStringList

It accepts 5, 6, or 7 fields, separated by spaces, and interprets them the same way as CalendarSpec.

$endTime read-only

If endTime is set, any timestamps after endTime will be skipped.

public DateTimeInterface|null $endTime

$excludeCalendarList read-only

Any timestamps matching any of exclude* will be skipped.

public array<int, CalendarSpec> $excludeCalendarList

$excludeStructuredCalendarList read-only

Any timestamps matching any of exclude* will be skipped.

public array<int, StructuredCalendarSpec> $excludeStructuredCalendarList

$jitter read-only

All timestamps will be incremented by a random value from 0 to this amount of jitter.

public DateInterval $jitter

$startTime read-only

If startTime is set, any timestamps before startTime will be skipped.

public DateTimeInterface|null $startTime

(Together, startTime and endTime make an inclusive interval.)

$timezoneName read-only

Time zone to interpret all calendar-based specs in.

public string $timezoneName

Methods

withAddedCronString()

A traditional cron specification as a string.

public withAddedCronString(Stringable|non-empty-string $cron) : self

It accepts 5, 6, or 7 fields, separated by spaces, and interprets them the same way as CalendarSpec.

Parameters
$cron : Stringable|non-empty-string
Return values
self

withAddedExcludeCalendar()

Any timestamps matching any of exclude* will be skipped.

public withAddedExcludeCalendar(CalendarSpec $calendar) : self
Parameters
$calendar : CalendarSpec
Return values
self

withAddedInterval()

Interval-based specifications of times.

public withAddedInterval(DateIntervalValue|IntervalSpec $interval) : self
Parameters
$interval : DateIntervalValue|IntervalSpec
Return values
self

withCalendarList()

Returns a new instance with the replaced calendar list.

public withCalendarList(CalendarSpec ...$calendar) : self
Parameters
$calendar : CalendarSpec
Return values
self

withCronStringList()

Returns a new instance with the replaced cron string list.

public withCronStringList(Stringable|string ...$cron) : self
Parameters
$cron : Stringable|string
Return values
self

withEndTime()

If endTime is set, any timestamps after endTime will be skipped.

public withEndTime(DateTimeInterface|string|null $dateTime) : self
Parameters
$dateTime : DateTimeInterface|string|null
Return values
self

withExcludeCalendarList()

Returns a new instance with the replaced exclude calendar list.

public withExcludeCalendarList(CalendarSpec ...$calendar) : self
Parameters
$calendar : CalendarSpec
Return values
self

withExcludeStructuredCalendarList()

Returns a new instance with the replaced exclude structured calendar list.

public withExcludeStructuredCalendarList(StructuredCalendarSpec ...$structuredCalendar) : self
Parameters
$structuredCalendar : StructuredCalendarSpec
Return values
self

withIntervalList()

Returns a new instance with the replaced interval list.

public withIntervalList(DateIntervalValue|IntervalSpec ...$interval) : self
Parameters
$interval : DateIntervalValue|IntervalSpec
Return values
self

withJitter()

All timestamps will be incremented by a random value from 0 to this amount of jitter.

public withJitter(DateIntervalValue|null $interval) : self
Parameters
$interval : DateIntervalValue|null

Int value means seconds

Return values
self

withStartTime()

If startTime is set, any timestamps before startTime will be skipped.

public withStartTime(DateTimeInterface|string|null $dateTime) : self

(Together, startTime and endTime make an inclusive interval.)

Parameters
$dateTime : DateTimeInterface|string|null
Return values
self

withTimezoneData()

public withTimezoneData(string $timezoneData) : self
Parameters
$timezoneData : string
Return values
self

withTimezoneName()

Time zone to interpret all calendar-based specs in.

public withTimezoneName(string $timezoneName) : self

If unset, defaults to UTC. We recommend using UTC for your application if at all possible, to avoid various surprising properties of time zones. Time zones may be provided by name, corresponding to names in the IANA time zone database (see https://www.iana.org/time-zones). The definition will be loaded by the Temporal server from the environment it runs in. If your application requires more control over the time zone definition used, it may pass in a complete definition in the form of a TZif file from the time zone database. If present, this will be used instead of loading anything from the environment. You are then responsible for updating self::$timezoneData when the definition changes. Calendar spec matching is based on literal matching of the clock time with no special handling of DST: if you write a calendar spec that fires at 2:30am and specify a time zone that follows DST, that action will not be triggered on the day that has no 2:30am. Similarly, an action that fires at 1:30am will be triggered twice on the day that has two 1:30s. Also note that no actions are taken on leap-seconds (e.g. 23:59:60 UTC).

Parameters
$timezoneName : string
Return values
self

        
On this page

Search results