JsonValue
in package
Preserve JSON object and array types when accepting PHP values.
Table of Contents
Methods
- copy() : mixed
- Copy JSON values and reject unsupported values or invalid UTF-8 strings and keys. A copy stops at the value limits of Text: a shared array is copied at each place, so the limits bound a value that denotes a large tree or contains itself through a reference.
- isArrayIndex() : bool
- Whether a member name is an array index: a canonical decimal integer 0..4294967294.
- isObject() : bool
- Identify explicit JSON objects and PHP associative arrays.
- members() : array<string|int, mixed>
- Return a structural map without converting its child values.
- object() : stdClass
- Copy a root object, accepting an empty PHP array for the root.
- ordered() : mixed
- Copy a specification value in specification member order: every object lists array-index member names (canonical decimal integers 0..4294967294) first in ascending numeric order, then all other names in insertion order. Objects become stdClass values; lists stay lists.
- orderedMembers() : array<string|int, mixed>
- Order a structural member map in specification member order, keeping it a PHP array keyed by member name; nested stdClass values and PHP associative arrays keep their own types.
- orderedObject() : stdClass
- Copy a root specification object in specification member order.
- admit() : void
- Count a node at $depth, or reject a value beyond the limits of Text.
- copyValue() : mixed
- order() : mixed
- Order objects recursively; $arrays keeps nested associative arrays as arrays.
Methods
copy()
Copy JSON values and reject unsupported values or invalid UTF-8 strings and keys. A copy stops at the value limits of Text: a shared array is copied at each place, so the limits bound a value that denotes a large tree or contains itself through a reference.
public
static copy(mixed $value) : mixed
Parameters
- $value : mixed
isArrayIndex()
Whether a member name is an array index: a canonical decimal integer 0..4294967294.
public
static isArrayIndex(string $name) : bool
Parameters
- $name : string
Return values
boolisObject()
Identify explicit JSON objects and PHP associative arrays.
public
static isObject(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolmembers()
Return a structural map without converting its child values.
public
static members(mixed $value) : array<string|int, mixed>
Parameters
- $value : mixed
Return values
array<string|int, mixed>object()
Copy a root object, accepting an empty PHP array for the root.
public
static object(array<string|int, mixed>|stdClass $value) : stdClass
Parameters
- $value : array<string|int, mixed>|stdClass
Return values
stdClassordered()
Copy a specification value in specification member order: every object lists array-index member names (canonical decimal integers 0..4294967294) first in ascending numeric order, then all other names in insertion order. Objects become stdClass values; lists stay lists.
public
static ordered(mixed $value) : mixed
Parameters
- $value : mixed
orderedMembers()
Order a structural member map in specification member order, keeping it a PHP array keyed by member name; nested stdClass values and PHP associative arrays keep their own types.
public
static orderedMembers(array<string|int, mixed> $members) : array<string|int, mixed>
Parameters
- $members : array<string|int, mixed>
Return values
array<string|int, mixed>orderedObject()
Copy a root specification object in specification member order.
public
static orderedObject(array<string|int, mixed>|stdClass $value) : stdClass
Parameters
- $value : array<string|int, mixed>|stdClass
Return values
stdClassadmit()
Count a node at $depth, or reject a value beyond the limits of Text.
private
static admit(mixed $value, int $depth, int &$nodes) : void
Parameters
- $value : mixed
- $depth : int
- $nodes : int
copyValue()
private
static copyValue(mixed $value, int $depth, int &$nodes) : mixed
Parameters
- $value : mixed
- $depth : int
- $nodes : int
order()
Order objects recursively; $arrays keeps nested associative arrays as arrays.
private
static order(mixed $value, int $depth, bool $arrays, int &$nodes) : mixed
Parameters
- $value : mixed
- $depth : int
- $arrays : bool
- $nodes : int