Schemas
class Schemas extends GroupedTagBuilder
Methods
Get the builder key.
Determine whether no schemas are defined.
Get the dot-notated key this builder occupies in the Head::toArray() result.
Grouped tag builders are represented as an empty array when absent from the Head::toArray() result.
Get the supported route attribute names.
Build schemas from a route attribute.
Determine if the builder should render even when no data was set.
Resolve a string or string-backed enum value.
Normalize a route attribute value into a list of items.
Create the schema collection.
Add a schema, deduplicating objects by identity and arrays by content.
Get the ordered schema definitions.
Copy mutable schema objects for independent coroutine state.
Details
at line 30
static string
key()
Get the builder key.
at line 84
TagBuilder
overlayOn(TagBuilder|null $base)
Overlay these schemas onto the lower layer.
at line 96
bool
isEmpty()
Determine whether no schemas are defined.
in
TagBuilder at line 32
static string
headArrayKey()
Get the dot-notated key this builder occupies in the Head::toArray() result.
in
GroupedTagBuilder at line 13
static mixed
headArrayDefault()
Grouped tag builders are represented as an empty array when absent from the Head::toArray() result.
at line 40
static array
routeAttributeKeys()
Get the supported route attribute names.
at line 48
static TagBuilder|null
fromRouteAttribute(string $key, mixed $value)
Build schemas from a route attribute.
in
TagBuilder at line 66
static bool
rendersWhenEmpty(ResolvedHead $head)
Determine if the builder should render even when no data was set.
in
TagBuilder at line 74
TagBuilder
asDefaults()
Mark the builder's data as belonging to the defaults layer.
at line 106
mixed
toHeadArray(ResolvedHead $head)
Validate and resolve all schemas for the head array.
at line 122
array
toTags(ResolvedHead $head, TagRenderer $tags)
Render each schema as JSON-LD.
in
TagBuilder at line 100
static protected string|null
string(mixed $value)
Return the value when it is a string.
in
TagBuilder at line 108
static protected string|null
stringOrBackedEnum(mixed $value)
Resolve a string or string-backed enum value.
in
TagBuilder at line 124
static protected bool|null
bool(mixed $value)
Return the value when it is a boolean.
in
TagBuilder at line 132
static protected int|null
int(mixed $value)
Return the value when it is an integer.
in
TagBuilder at line 142
static protected array
items(mixed $value)
Normalize a route attribute value into a list of items.
in
TagBuilder at line 153
static protected array
named(array $values)
Filter an array down to its string-keyed values.
at line 23
__construct(array $schemas = [])
Create the schema collection.
at line 74
Schemas
schema(SchemaObject|array $schema)
Add a schema, deduplicating objects by identity and arrays by content.
at line 135
protected array
headArray()
Get the ordered schema definitions.
at line 143
void
__clone()
Copy mutable schema objects for independent coroutine state.