class Article 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

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.

headline(string $headline)

Set the article headline.

description(string $description)

Set the article description.

author(Person|Organization $author)

Set the article author.

publishedAt(DateTimeInterface|string $date)

Set the publication date.

modifiedAt(DateTimeInterface|string $date)

Set the modification date.

image(string|array $image)

Set the article images.

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 16
Article headline(string $headline)

Set the article headline.

Parameters

string $headline

Return Value

Article

at line 24
Article description(string $description)

Set the article description.

Parameters

string $description

Return Value

Article

at line 32
Article author(Person|Organization $author)

Set the article author.

Parameters

Person|Organization $author

Return Value

Article

at line 40
Article publishedAt(DateTimeInterface|string $date)

Set the publication date.

Parameters

DateTimeInterface|string $date

Return Value

Article

at line 48
Article modifiedAt(DateTimeInterface|string $date)

Set the modification date.

Parameters

DateTimeInterface|string $date

Return Value

Article

at line 58
Article image(string|array $image)

Set the article images.

Parameters

string|array $image

Return Value

Article