class Breadcrumbs extends SchemaObject

Properties

protected string $type from  SchemaObject
protected array<string, mixed> $properties from  SchemaObject
static protected array<class-string<static>, string> $types from  SchemaObject
protected array<int, array{'@type': string, position: int, name: string, item: string}> $items

Methods

__construct(string|null $type = null)

Create a schema with an explicit or inferred type.

set(string $property, mixed $value)

Set a schema property, coercing nested schema objects and dates.

date(string $property, DateTimeInterface|string $date)

Set a date property using an ISO 8601 value.

array
toArray()

Get the schema type and properties.

array
toJsonLd()

Get the schema with its JSON-LD context.

array
jsonSerialize()

Get the schema's JSON representation.

__call(string $method, array $parameters)

Dynamically set the schema property named by the called method.

mixed
coerce(mixed $value)

Normalize nested schemas and dates into their serialized values.

string
typeFromAttribute()

Resolve the schema.org type from the SchemaType attribute or the class name.

static void
flushState()

Flush all static state.

item(string $name, string $url)

Append a breadcrumb item.

items(array $items)

Append breadcrumb items in order.

Details

in SchemaObject at line 31
__construct(string|null $type = null)

Create a schema with an explicit or inferred type.

Parameters

string|null $type

in SchemaObject at line 39
SchemaObject set(string $property, mixed $value)

Set a schema property, coercing nested schema objects and dates.

Parameters

string $property
mixed $value

Return Value

SchemaObject

in SchemaObject at line 49
SchemaObject date(string $property, DateTimeInterface|string $date)

Set a date property using an ISO 8601 value.

Parameters

string $property
DateTimeInterface|string $date

Return Value

SchemaObject

in SchemaObject at line 59
array toArray()

Get the schema type and properties.

Return Value

array

in SchemaObject at line 69
array toJsonLd()

Get the schema with its JSON-LD context.

Return Value

array

in SchemaObject at line 79
array jsonSerialize()

Get the schema's JSON representation.

Return Value

array

in SchemaObject at line 89
SchemaObject __call(string $method, array $parameters)

Dynamically set the schema property named by the called method.

Parameters

string $method
array $parameters

Return Value

SchemaObject

in SchemaObject at line 105
protected mixed coerce(mixed $value)

Normalize nested schemas and dates into their serialized values.

Parameters

mixed $value

Return Value

mixed

in SchemaObject at line 125
protected string typeFromAttribute()

Resolve the schema.org type from the SchemaType attribute or the class name.

Return Value

string

in SchemaObject at line 142
static void flushState()

Flush all static state.

Return Value

void

at line 18
Breadcrumbs item(string $name, string $url)

Append a breadcrumb item.

Parameters

string $name
string $url

Return Value

Breadcrumbs

at line 35
Breadcrumbs items(array $items)

Append breadcrumb items in order.

Parameters

array $items

breadcrumb names keyed to their URLs

Return Value

Breadcrumbs