class CronExpressionTimezoneConverter (View source)

Methods

static string[]
forEvent(Event $event, DateTimeZone $timezone)

Convert an event cron expression to the display timezone.

static DateTimeZone
resolveEventTimezone(Event $event, DateTimeZone $defaultTimezone)

Resolve the timezone used by the given event.

static array{int, int, int}|null
offsetComponents(Event $event, DateTimeZone $eventTimezone, DateTimeZone $displayTimezone)

Get offset components between the event and display timezones.

static array<int, string>|null
convert(array $segments, int $hourOffset, int $minuteOffset)

Convert the expression segments by the given offsets.

static array<int, string>|null
expressionsForHourCarry(array $segments, array $parts, int $hourCarry)

Build expressions for the given hour carry direction.

static array<int, array{string, string}>|null
shiftDaysOfMonth(string $domField, string $monthField, int $carry)

Shift the day-of-month field by the given carry, respecting month lengths.

static int
daysInMonth(int $month)

Get the number of days in the given month of a non-leap year.

static array<int, string>|null
shiftedGroups(string $field, int $offset, int $min, int $max, bool $mergeCarries)

Shift a cron field by the given offset and group it by carry direction.

static array<int, int>|null
expand(string $field, int $min, int $max)

Expand a cron field into the sorted list of values it matches.

static array<int, array<int, int>>
shiftAndGroupValues(array $values, int $offset, int $mod, int $min = 0)

Shift values in a cron field and group them by carry direction.

static array<int, int>
shiftWrapped(array $values, int $offset, int $mod, int $min = 0)

Shift values within a cron field, wrapping around its domain.

static array<int, int>
mergeGroups(array $groups)

Merge grouped values into a single sorted group.

static string
collapse(array $values, int $min, int $max)

Collapse a sorted list of values into the most compact cron field syntax.

static string
collapseRuns(array $values)

Collapse consecutive runs of three or more values into ranges.

Details

static string[] forEvent(Event $event, DateTimeZone $timezone)

Convert an event cron expression to the display timezone.

Returns one or more expressions when values straddle a day boundary.

Parameters

Event $event
DateTimeZone $timezone

Return Value

string[]

static protected DateTimeZone resolveEventTimezone(Event $event, DateTimeZone $defaultTimezone)

Resolve the timezone used by the given event.

Parameters

Event $event
DateTimeZone $defaultTimezone

Return Value

DateTimeZone

static protected array{int, int, int}|null offsetComponents(Event $event, DateTimeZone $eventTimezone, DateTimeZone $displayTimezone)

Get offset components between the event and display timezones.

Parameters

Event $event
DateTimeZone $eventTimezone
DateTimeZone $displayTimezone

Return Value

array{int, int, int}|null

static protected array<int, string>|null convert(array $segments, int $hourOffset, int $minuteOffset)

Convert the expression segments by the given offsets.

Parameters

array $segments
int $hourOffset
int $minuteOffset

Return Value

array<int, string>|null

static protected array<int, string>|null expressionsForHourCarry(array $segments, array $parts, int $hourCarry)

Build expressions for the given hour carry direction.

Parameters

array $segments
array $parts
int $hourCarry

Return Value

array<int, string>|null

static protected array<int, array{string, string}>|null shiftDaysOfMonth(string $domField, string $monthField, int $carry)

Shift the day-of-month field by the given carry, respecting month lengths.

Parameters

string $domField
string $monthField
int $carry

Return Value

array<int, array{string, string}>|null

static protected int daysInMonth(int $month)

Get the number of days in the given month of a non-leap year.

Parameters

int $month

Return Value

int

static protected array<int, string>|null shiftedGroups(string $field, int $offset, int $min, int $max, bool $mergeCarries)

Shift a cron field by the given offset and group it by carry direction.

Parameters

string $field
int $offset
int $min
int $max
bool $mergeCarries

Return Value

array<int, string>|null

static protected array<int, int>|null expand(string $field, int $min, int $max)

Expand a cron field into the sorted list of values it matches.

Parameters

string $field
int $min
int $max

Return Value

array<int, int>|null

static protected array<int, array<int, int>> shiftAndGroupValues(array $values, int $offset, int $mod, int $min = 0)

Shift values in a cron field and group them by carry direction.

Parameters

array $values
int $offset
int $mod
int $min

Return Value

array<int, array<int, int>>

static protected array<int, int> shiftWrapped(array $values, int $offset, int $mod, int $min = 0)

Shift values within a cron field, wrapping around its domain.

Parameters

array $values
int $offset
int $mod
int $min

Return Value

array<int, int>

static protected array<int, int> mergeGroups(array $groups)

Merge grouped values into a single sorted group.

Parameters

array $groups

Return Value

array<int, int>

static protected string collapse(array $values, int $min, int $max)

Collapse a sorted list of values into the most compact cron field syntax.

Parameters

array $values
int $min
int $max

Return Value

string

static protected string collapseRuns(array $values)

Collapse consecutive runs of three or more values into ranges.

Parameters

array $values

Return Value

string