SlotFlow API Documentation

WeeklyCalendar
in package

FinalYes

Repeating weekly schedule used by shipment and dispatch calendars.

Table of Contents

Properties

$moments  : array<int, WeeklyCalendarMoment>
$rejectInvalidLocalTimes  : bool
$windows  : array<int, WeeklyCalendarWindow>

Methods

__construct()  : mixed
Create one weekly calendar from moments and windows.
fromMap()  : self
Build one weekly calendar from a weekday => list of moment/window expressions map.
merge()  : self
Merge multiple weekly calendars into one deduplicated calendar.
nextTime()  : int
Return the first bucket index at or after the given time that matches this weekly schedule.
assertValidLocalTime()  : void
earlierDateTime()  : DateTimeImmutable
expandDaySelector()  : array<int, int>
isoFromZeroBased()  : int
normalizeDayToken()  : int
parseEntry()  : WeeklyCalendarMoment|WeeklyCalendarWindow
startOfIsoWeek()  : DateTimeImmutable

Properties

$rejectInvalidLocalTimes read-only

public bool $rejectInvalidLocalTimes = false

Methods

fromMap()

Build one weekly calendar from a weekday => list of moment/window expressions map.

public static fromMap(array<int|string, string|array<int, string>> $map[, bool $rejectInvalidLocalTimes = false ]) : self

Example: ['mon-thu,fri' => ['10:00', '13:00-16:00'], '6,7' => ['09:00']]

Parameters
$map : array<int|string, string|array<int, string>>
$rejectInvalidLocalTimes : bool = false
Return values
self

merge()

Merge multiple weekly calendars into one deduplicated calendar.

public static merge(self ...$calendars) : self
Parameters
$calendars : self
Return values
self

nextTime()

Return the first bucket index at or after the given time that matches this weekly schedule.

public nextTime(TimeAxis $axis, int $earliestTime) : int
Parameters
$axis : TimeAxis
$earliestTime : int
Return values
int

earlierDateTime()

private earlierDateTime(DateTimeImmutable|null $current, DateTimeImmutable $candidate) : DateTimeImmutable
Parameters
$current : DateTimeImmutable|null
$candidate : DateTimeImmutable
Return values
DateTimeImmutable

expandDaySelector()

private static expandDaySelector(int|string $selector) : array<int, int>
Parameters
$selector : int|string
Return values
array<int, int>

isoFromZeroBased()

private static isoFromZeroBased(int $index) : int
Parameters
$index : int
Return values
int

normalizeDayToken()

private static normalizeDayToken(string $token) : int
Parameters
$token : string
Return values
int

startOfIsoWeek()

private startOfIsoWeek(DateTimeImmutable $time) : DateTimeImmutable
Parameters
$time : DateTimeImmutable
Return values
DateTimeImmutable

        
On this page

Search results