DXNOrderedMap
in package
implements
DXNValueInterface
DXN `ordered-map` (`@ordered %{...}`) -- order is part of value identity. Wrapped rather than a bare associative PHP array (which already claims `map`, the no-ordering-guarantee sibling) so the two stay distinguishable on encode; also because a DXN map/ordered-map key can be any DXN value, not just an `int|string` the way a native PHP array key must be.
Tags
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 = 'ordered-map'
Properties
- $pairs : array<int, Pair>
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.
- fromArray() : self
- toArray() : array<int|string, mixed>
- Converts to an associative PHP array -- only lossless when every key is already an `int|string` (a DXN map/ordered-map key can be any DXN value); throws otherwise.
Constants
DXN_TYPE
private
mixed
DXN_TYPE
= 'ordered-map'
Properties
$pairs read-only
public
array<int, Pair>
$pairs
Methods
__construct()
public
__construct(array<string|int, Pair> $pairs) : mixed
Parameters
- $pairs : array<string|int, Pair>
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
Return values
boolfromArray()
public
static fromArray(array<int|string, mixed> $map) : self
Parameters
- $map : array<int|string, mixed>
Return values
selftoArray()
Converts to an associative PHP array -- only lossless when every key is already an `int|string` (a DXN map/ordered-map key can be any DXN value); throws otherwise.
public
toArray() : array<int|string, mixed>