DXNStruct
in package
implements
DXNValueInterface
DXN `struct` (`%Name{...}` / `%Name[...]`), opaque without a schema. Keeps the keyed/positional shapes distinct rather than normalizing to one, same as the Elixir and JS ports -- `.dxnb` is always positional and can't recover field names without a schema.
This is decode's default representation for an unregistered struct
name; on encode, any plain PHP object with public properties is
also accepted directly (see Equality::kindOf()) without
needing to be built into a DXNStruct by hand first.
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 = 'struct'
Properties
Methods
- 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.
- isKeyed() : bool
- isPositional() : bool
- keyed() : self
- pairs() : array<int, Pair>
- positional() : self
- values() : array<int, mixed>
- __construct() : mixed
Constants
DXN_TYPE
private
mixed
DXN_TYPE
= 'struct'
Properties
$kind read-only
public
string
$kind
$name read-only
public
string
$name
$pairs read-only
private
array<int, Pair>
$pairs
$values read-only
private
array<int, mixed>
$values
Methods
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
boolisKeyed()
public
isKeyed() : bool
Return values
boolisPositional()
public
isPositional() : bool
Return values
boolkeyed()
public
static keyed(string $name, array<string|int, Pair> $pairs) : self
Parameters
- $name : string
- $pairs : array<string|int, Pair>
Return values
selfpairs()
public
pairs() : array<int, Pair>
Return values
array<int, Pair>positional()
public
static positional(string $name, array<string|int, mixed> $values) : self
Parameters
- $name : string
- $values : array<string|int, mixed>
Return values
selfvalues()
public
values() : array<int, mixed>
Return values
array<int, mixed>__construct()
private
__construct(string $name, string $kind, array<int, Pair> $pairs, array<int, mixed> $values) : mixed
Parameters
- $name : string
- $kind : string
- $pairs : array<int, Pair>
- $values : array<int, mixed>