SchemaObject
abstract class SchemaObject implements Arrayable, JsonSerializable, Transient
Properties
| protected string | $type | ||
| protected array<string, mixed> | $properties | ||
| static protected array<class-string<static>, string> | $types |
Methods
Create a schema with an explicit or inferred type.
Set a schema property, coercing nested schema objects and dates.
Get the schema type and properties.
Get the schema with its JSON-LD context.
Get the schema's JSON representation.
Dynamically set the schema property named by the called method.
Normalize nested schemas and dates into their serialized values.
Resolve the schema.org type from the SchemaType attribute or the class name.
Flush all static state.
Details
at line 31
__construct(string|null $type = null)
Create a schema with an explicit or inferred type.
at line 39
SchemaObject
set(string $property, mixed $value)
Set a schema property, coercing nested schema objects and dates.
at line 49
SchemaObject
date(string $property, DateTimeInterface|string $date)
Set a date property using an ISO 8601 value.
at line 59
array
toArray()
Get the schema type and properties.
at line 69
array
toJsonLd()
Get the schema with its JSON-LD context.
at line 79
array
jsonSerialize()
Get the schema's JSON representation.
at line 89
SchemaObject
__call(string $method, array $parameters)
Dynamically set the schema property named by the called method.
at line 105
protected mixed
coerce(mixed $value)
Normalize nested schemas and dates into their serialized values.
at line 125
protected string
typeFromAttribute()
Resolve the schema.org type from the SchemaType attribute or the class name.
at line 142
static void
flushState()
Flush all static state.