TemporalContext
in package
The temporal configuration a slot space is expanded along: a time axis, the resolver that gives each movement edge a duration, and the calendar that may delay when an edge departs.
This is the whole of what the timed layer needs from a slot space, gathered into one value so a space carries a single temporal dependency rather than three, and so the raw-callable normalization lives in one place instead of once per consumer.
Instances are immutable; the with* methods return copies.
Table of Contents
Properties
- $axis : TimeAxis|null
- $dispatchCalendar : DispatchCalendarInterface|null
- $durationResolver : TimedDurationResolverInterface|null
Methods
- __construct() : mixed
- Create one temporal context.
- normalizeDispatchCalendar() : DispatchCalendarInterface|null
- Normalize a raw dispatch calendar into the interface, wrapping a callable if needed.
- normalizeDurationResolver() : TimedDurationResolverInterface|null
- Normalize a raw duration resolver into the interface, wrapping a Closure if needed.
- of() : self
- Build a context from raw inputs, normalizing callables into their interface wrappers.
- withAxis() : self
- Return a copy carrying the given time axis.
- withDispatchCalendar() : self
- Return a copy carrying the given dispatch calendar.
- withDurationResolver() : self
- Return a copy carrying the given duration resolver.
Properties
$axis read-only
public
TimeAxis|null
$axis
= null
$dispatchCalendar read-only
public
DispatchCalendarInterface|null
$dispatchCalendar
= null
$durationResolver read-only
public
TimedDurationResolverInterface|null
$durationResolver
= null
Methods
__construct()
Create one temporal context.
public
__construct([TimeAxis|null $axis = null ][, TimedDurationResolverInterface|null $durationResolver = null ][, DispatchCalendarInterface|null $dispatchCalendar = null ]) : mixed
Parameters
- $axis : TimeAxis|null = null
- $durationResolver : TimedDurationResolverInterface|null = null
- $dispatchCalendar : DispatchCalendarInterface|null = null
normalizeDispatchCalendar()
Normalize a raw dispatch calendar into the interface, wrapping a callable if needed.
public
static normalizeDispatchCalendar(DispatchCalendarInterface|callable|null $dispatchCalendar) : DispatchCalendarInterface|null
Parameters
- $dispatchCalendar : DispatchCalendarInterface|callable|null
Return values
DispatchCalendarInterface|nullnormalizeDurationResolver()
Normalize a raw duration resolver into the interface, wrapping a Closure if needed.
public
static normalizeDurationResolver(mixed $durationResolver) : TimedDurationResolverInterface|null
A wrapped Closure is validated at call time rather than declaration time, because a Closure carries no return type the wrapper could check up front.
Parameters
- $durationResolver : mixed
Tags
Return values
TimedDurationResolverInterface|nullof()
Build a context from raw inputs, normalizing callables into their interface wrappers.
public
static of([TimeAxis|null $axis = null ][, TimedDurationResolverInterface|Closure|null $durationResolver = null ][, DispatchCalendarInterface|callable|null $dispatchCalendar = null ]) : self
Parameters
- $axis : TimeAxis|null = null
- $durationResolver : TimedDurationResolverInterface|Closure|null = null
- $dispatchCalendar : DispatchCalendarInterface|callable|null = null
Tags
Return values
selfwithAxis()
Return a copy carrying the given time axis.
public
withAxis(TimeAxis|null $axis) : self
Parameters
- $axis : TimeAxis|null
Return values
selfwithDispatchCalendar()
Return a copy carrying the given dispatch calendar.
public
withDispatchCalendar(DispatchCalendarInterface|callable|null $dispatchCalendar) : self
Parameters
- $dispatchCalendar : DispatchCalendarInterface|callable|null
Return values
selfwithDurationResolver()
Return a copy carrying the given duration resolver.
public
withDurationResolver(mixed $durationResolver) : self
Parameters
- $durationResolver : mixed