DatedValues
in package
Read onlyYes
FinalYes
Values that change on dates, e.g. tax rates or reference interest rates: every value holds from its date until the next change.
Table of Contents
Methods
- __construct() : mixed
- changes() : array<string, string>
- Every change: ISO date => value, sorted by date.
- lastChange() : Date|null
- Date of the last change; null without values.
- on() : string|null
- The value that holds on the date; null before the first change.
- periods() : array<int, Date, value: string}>
- The periods of constant value between two dates (both included), in order; days before the first change are left out.
- withValue() : self
- A copy with a value that holds from $from on; an existing value of that date is replaced.
Methods
__construct()
public
__construct(array<string, string> $values) : mixed
Parameters
- $values : array<string, string>
-
ISO date (YYYY-MM-DD) => value from that date on
Tags
changes()
Every change: ISO date => value, sorted by date.
public
changes() : array<string, string>
Return values
array<string, string>lastChange()
Date of the last change; null without values.
public
lastChange() : Date|null
Return values
Date|nullon()
The value that holds on the date; null before the first change.
public
on(Date $date) : string|null
Parameters
- $date : Date
Return values
string|nullperiods()
The periods of constant value between two dates (both included), in order; days before the first change are left out.
public
periods(Date $from, Date $until) : array<int, Date, value: string}>
Parameters
Return values
array<int, Date, value: string}>withValue()
A copy with a value that holds from $from on; an existing value of that date is replaced.
public
withValue(Date|string $from, string $value) : self
Parameters
- $from : Date|string
- $value : string