DXNDuration
in package
implements
DXNValueInterface
FinalYes
DXN `duration` (`@duration "P1Y2M"`) -- 7 independent, individually optional fields, not reducible to one scalar. No conversion helper: PHP's `DateInterval` exists, but normalizes `P1W` into `days = 7` internally, losing the weeks/days distinction DXN keeps independent -- not a clean conversion target.
Table of Contents
Interfaces
- DXNValueInterface
- Implemented by every `DXN*` wrapper class -- the PHP analog of the `dxnType` string tag used for kind dispatch in the JS port, and of `Dextrin.Value`'s closed type union in the Elixir original. Native PHP values (`null`, `bool`, `int`, `float`, `string`, and `array` for `map`/`array`) never implement this; {@see Equality::kindOf()} handles those directly.
Constants
- DXN_TYPE : mixed = 'duration'
Properties
- $days : int|null
- $hours : int|null
- $microseconds : int|null
- $minutes : int|null
- $months : int|null
- $weeks : int|null
- $years : int|null
Methods
- __construct() : mixed
- compareTo() : int
- A total order against any other DXN value, not just another instance of this class -- backs {@see DXNSortedSet}. Cross-kind ordering is implementation-defined per DXN.md; within a kind, uses the kind's own natural order where one exists, or a deterministic structural fallback where it doesn't.
- dxnType() : string
- The DXN type name this value represents, e.g. "symbol", "uuid".
- equals() : bool
- Structural equality, recursing into nested DXN values as needed.
Constants
DXN_TYPE
private
mixed
DXN_TYPE
= 'duration'
Properties
$days read-only
public
int|null
$days
= null
$hours read-only
public
int|null
$hours
= null
$microseconds read-only
public
int|null
$microseconds
= null
$minutes read-only
public
int|null
$minutes
= null
$months read-only
public
int|null
$months
= null
$weeks read-only
public
int|null
$weeks
= null
$years read-only
public
int|null
$years
= null
Methods
__construct()
public
__construct([int|null $years = null ][, int|null $months = null ][, int|null $weeks = null ][, int|null $days = null ][, int|null $hours = null ][, int|null $minutes = null ][, int|null $microseconds = null ]) : mixed
Parameters
- $years : int|null = null
- $months : int|null = null
- $weeks : int|null = null
- $days : int|null = null
- $hours : int|null = null
- $minutes : int|null = null
- $microseconds : int|null = null
compareTo()
A total order against any other DXN value, not just another instance of this class -- backs {@see DXNSortedSet}. Cross-kind ordering is implementation-defined per DXN.md; within a kind, uses the kind's own natural order where one exists, or a deterministic structural fallback where it doesn't.
public
compareTo(mixed $other) : int
Parameters
- $other : mixed
Return values
intdxnType()
The DXN type name this value represents, e.g. "symbol", "uuid".
public
dxnType() : string
Return values
stringequals()
Structural equality, recursing into nested DXN values as needed.
public
equals(mixed $other) : bool
Parameters
- $other : mixed