Value
in package
Preserve JSON values and resolve form paths and presentation strings.
Table of Contents
Methods
- classes() : string
- Join class strings with normalized whitespace.
- condition() : string
- The condition text of a condition field value (docs/spec/form-markup.md, Condition fields): a string is itself, null and an absent value are empty, and any other value is the JSON text that ECMAScript's JSON.stringify writes for it.
- controlId() : string
- Encode the instance prefix and complete field path as a control identifier.
- copy() : mixed
- Return a detached JSON value while preserving object and array types.
- display() : string
- Select the default only when the field value is absent.
- elementId() : string
- Convert a field path to its structural element identifier.
- formData() : stdClass
- Copy PHP form data as a JSON object: a stdClass, an associative array or the empty array (the empty object). A non-empty list array and any other value are no object (CURP-026), and fail with the root message of CURT-001.
- get() : mixed
- Read one own member or return the missing-value marker.
- isObject() : bool
- A stdClass, or a non-empty PHP array that is not a list: what a declaration takes for an object.
- leaf() : string
- Return the final field name, including repeated-value notation.
- name() : string
- Convert a field path into a bracketed submission name.
- object() : stdClass
- Copy a PHP root record as a JSON object.
- path() : mixed
- Read a value through bracket or dot path segments.
- record() : stdClass
- Build an object while omitting members marked as absent.
- rule() : string
- Create a validation rule name with anonymous repeated segments.
- scalar() : string
- Format a scalar value for a form control; objects and null are empty.
- segments() : array<string|int, mixed>
- Split a value path while retaining dots inside brackets.
- spec() : stdClass
- Copy a PHP root specification or template in specification member order.
- string() : string
- Format values using expression string conversion rules.
- style() : string|null
- Normalize CSS declarations for the evaluated model.
- translate() : string
- Resolve content: a string is itself; a language map yields the first non-empty string entry for the language, en, ko and then its first key; any other value, a list included, is the default.
- truthy() : bool
- Evaluate condition truthiness while keeping empty collections true.
- conditionJson() : string
- The JSON.stringify text of a JSON value: members in order, no whitespace, ECMAScript numbers.
Methods
classes()
Join class strings with normalized whitespace.
public
static classes(string ...$parts) : string
Parameters
- $parts : string
Return values
stringcondition()
The condition text of a condition field value (docs/spec/form-markup.md, Condition fields): a string is itself, null and an absent value are empty, and any other value is the JSON text that ECMAScript's JSON.stringify writes for it.
public
static condition(mixed $value) : string
Parameters
- $value : mixed
Return values
stringcontrolId()
Encode the instance prefix and complete field path as a control identifier.
public
static controlId(string $prefix, string $path) : string
Parameters
- $prefix : string
- $path : string
Return values
stringcopy()
Return a detached JSON value while preserving object and array types.
public
static copy(mixed $value) : mixed
Parameters
- $value : mixed
display()
Select the default only when the field value is absent.
public
static display(mixed $value, mixed $default) : string
Parameters
- $value : mixed
- $default : mixed
Return values
stringelementId()
Convert a field path to its structural element identifier.
public
static elementId(string $prefix, string $path) : string
Parameters
- $prefix : string
- $path : string
Return values
stringformData()
Copy PHP form data as a JSON object: a stdClass, an associative array or the empty array (the empty object). A non-empty list array and any other value are no object (CURP-026), and fail with the root message of CURT-001.
public
static formData(mixed $value) : stdClass
Parameters
- $value : mixed
Return values
stdClassget()
Read one own member or return the missing-value marker.
public
static get(mixed $value, string $key) : mixed
Parameters
- $value : mixed
- $key : string
isObject()
A stdClass, or a non-empty PHP array that is not a list: what a declaration takes for an object.
public
static isObject(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolleaf()
Return the final field name, including repeated-value notation.
public
static leaf(string $path, array<string|int, mixed> $rows) : string
Parameters
- $path : string
- $rows : array<string|int, mixed>
Return values
stringname()
Convert a field path into a bracketed submission name.
public
static name(string $path[, string|null $prefix = null ]) : string
Parameters
- $path : string
- $prefix : string|null = null
Return values
stringobject()
Copy a PHP root record as a JSON object.
public
static object(array<string|int, mixed>|stdClass $value) : stdClass
Parameters
- $value : array<string|int, mixed>|stdClass
Return values
stdClasspath()
Read a value through bracket or dot path segments.
public
static path(mixed $value, string $path) : mixed
Parameters
- $value : mixed
- $path : string
record()
Build an object while omitting members marked as absent.
public
static record(array<string|int, mixed> $members) : stdClass
Parameters
- $members : array<string|int, mixed>
Return values
stdClassrule()
Create a validation rule name with anonymous repeated segments.
public
static rule(string $path, array<string|int, mixed> $rows) : string
Parameters
- $path : string
- $rows : array<string|int, mixed>
Return values
stringscalar()
Format a scalar value for a form control; objects and null are empty.
public
static scalar(mixed $value) : string
Parameters
- $value : mixed
Return values
stringsegments()
Split a value path while retaining dots inside brackets.
public
static segments(string $path) : array<string|int, mixed>
Parameters
- $path : string
Return values
array<string|int, mixed>spec()
Copy a PHP root specification or template in specification member order.
public
static spec(array<string|int, mixed>|stdClass $value) : stdClass
Parameters
- $value : array<string|int, mixed>|stdClass
Return values
stdClassstring()
Format values using expression string conversion rules.
public
static string(mixed $value) : string
Parameters
- $value : mixed
Return values
stringstyle()
Normalize CSS declarations for the evaluated model.
public
static style(mixed $style) : string|null
Parameters
- $style : mixed
Return values
string|nulltranslate()
Resolve content: a string is itself; a language map yields the first non-empty string entry for the language, en, ko and then its first key; any other value, a list included, is the default.
public
static translate(mixed $text, string $language[, string $default = '' ]) : string
Parameters
- $text : mixed
- $language : string
- $default : string = ''
Return values
stringtruthy()
Evaluate condition truthiness while keeping empty collections true.
public
static truthy(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolconditionJson()
The JSON.stringify text of a JSON value: members in order, no whitespace, ECMAScript numbers.
private
static conditionJson(mixed $value) : string
Parameters
- $value : mixed