PersonSchema extends AbstractSchema
Abstract schema class for schema.org objects. Note that only a small sub-set of schema.org objects are provided with this library.
Table of Contents
- SCHEMA_TYPE = 'Person'
- $asHtml : bool
- $images : array<string|int, mixed>
- $parameterBag : ParameterBag
- $sameAs : array<string|int, mixed>
- __toString() : string
- addAuthor() : self
- Add a PersonSchema object (author).
- addIdentifier() : self
- Add an identifier.
- addImage() : self
- Add an image URL.
- addSameAs() : self
- Add a "sameAs" URL string or array of URL strings.
- asHtml() : self
- Set true to return output as HTML.
- attachSchema() : self
- Attach a child schema.
- createFromTimberUser() : PersonSchema
- getAsHtml() : bool
- getAuthors() : SchemaCollection
- Returns a collection of PersonSchema objects (authors).
- getDateModified() : Carbon|null
- Get the "modified on" datetime.
- getDatePublished() : Carbon|null
- Get the "published on" datetime.
- getDescription() : string
- Get the value of description.
- getDisplayName() : string
- getFirstName() : string
- Get the value of firstName
- getImages() : array<string|int, mixed>
- Returns a set of image URLs.
- getInLanguage() : string
- Get the value of inLanguage (e.g. en_US, etc).
- getLastName() : string
- Get the value of lastName
- getOrganization() : OrganizationSchema
- getSameAs() : array<string|int, mixed>
- Returns a set of "sameAs" values.
- getThumbnail() : string
- Returns the thumbnail URL.
- getUrl() : string
- isEmpty() : bool
- Checks if the object is considered "empty". Objects are considered "empty" when they have no set schema.org properties set, excluding identifiers (e.g. keys beginnging with '@'). Objects with only identifiers set will be considered "empty".
- isPartnerOrganization() : bool
- render() : string
- Serializes to JSON.
- setDateModified() : self
- Set the "published on" datetime.
- setDatePublished() : self
- Set the "published on" datetime.
- setDescription() : self
- Set the value of description.
- setDisplayName() : self
- setFirstName() : self
- setInLanguage() : self
- setLastName() : self
- setOrganization() : self
- setPotentialAction() : self
- Set a "potentialAction" schema.
- setPublisher() : self
- Set the value of publisher.
- setThumbnail() : self
- Set the thumbnail URL.
- setUrl() : self
- toArray() : array<string|int, mixed>
- Returns the object's data into key value pairs based on the underlying schema.org entity structure.
- parameters() : ParameterBag
- imageToSchema() : ImageSchema|null
- Converts a Timber/Image object or string into an ImageSchema object.
Constants
SCHEMA_TYPE
public
mixed
SCHEMA_TYPE
= 'Person'
Properties
$asHtml
private
bool
$asHtml
= false
$images
private
array<string|int, mixed>
$images
= []
$parameterBag
private
ParameterBag
$parameterBag
$sameAs
private
array<string|int, mixed>
$sameAs
= []
Methods
__toString()
public
__toString() : string
Return values
string —addAuthor()
Add a PersonSchema object (author).
public
addAuthor(PersonSchema $person) : self
Parameters
- $person : PersonSchema
Return values
self —addIdentifier()
Add an identifier.
public
addIdentifier(string $key, string $value) : self
Parameters
- $key : string
- $value : string
Return values
self —addImage()
Add an image URL.
public
addImage(ImageSchema|Image|string $image) : self
Parameters
- $image : ImageSchema|Image|string
Return values
self —addSameAs()
Add a "sameAs" URL string or array of URL strings.
public
addSameAs(array<string|int, mixed>|string $url) : self
Parameters
- $url : array<string|int, mixed>|string
Tags
Return values
self —asHtml()
Set true to return output as HTML.
public
asHtml([bool $asHtml = true ]) : self
Parameters
- $asHtml : bool = true
-
Optional, default is true.
Return values
self —attachSchema()
Attach a child schema.
public
attachSchema(string $key[, Schema|null $schema = null ]) : self
Parameters
- $key : string
- $schema : Schema|null = null
Return values
self —createFromTimberUser()
public
static createFromTimberUser(User $user) : PersonSchema
Parameters
- $user : User
Return values
PersonSchema —getAsHtml()
public
getAsHtml() : bool
Return values
bool —getAuthors()
Returns a collection of PersonSchema objects (authors).
public
getAuthors() : SchemaCollection
Return values
SchemaCollection —getDateModified()
Get the "modified on" datetime.
public
getDateModified() : Carbon|null
Return values
Carbon|null —getDatePublished()
Get the "published on" datetime.
public
getDatePublished() : Carbon|null
Return values
Carbon|null —getDescription()
Get the value of description.
public
getDescription() : string
Return values
string —getDisplayName()
public
getDisplayName() : string
Return values
string —getFirstName()
Get the value of firstName
public
getFirstName() : string
Return values
string —getImages()
Returns a set of image URLs.
public
getImages() : array<string|int, mixed>
Return values
array<string|int, mixed> —getInLanguage()
Get the value of inLanguage (e.g. en_US, etc).
public
getInLanguage() : string
Return values
string —getLastName()
Get the value of lastName
public
getLastName() : string
Return values
string —getOrganization()
public
getOrganization() : OrganizationSchema
Return values
OrganizationSchema —getSameAs()
Returns a set of "sameAs" values.
public
getSameAs() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getThumbnail()
Returns the thumbnail URL.
public
getThumbnail() : string
Return values
string —getUrl()
public
getUrl() : string
Return values
string —isEmpty()
Checks if the object is considered "empty". Objects are considered "empty" when they have no set schema.org properties set, excluding identifiers (e.g. keys beginnging with '@'). Objects with only identifiers set will be considered "empty".
public
isEmpty() : bool
Tags
Return values
bool —isPartnerOrganization()
public
isPartnerOrganization() : bool
Return values
bool —render()
Serializes to JSON.
public
render() : string
Return values
string —setDateModified()
Set the "published on" datetime.
public
setDateModified(Carbon|string $dateModified[, string $timezone = '' ]) : self
Parameters
- $dateModified : Carbon|string
- $timezone : string = ''
-
Optional
Return values
self —setDatePublished()
Set the "published on" datetime.
public
setDatePublished(Carbon|string|null $datePublished[, string $timezone = '' ]) : self
Parameters
- $datePublished : Carbon|string|null
- $timezone : string = ''
-
Optional
Return values
self —setDescription()
Set the value of description.
public
setDescription(string|null $description) : self
Parameters
- $description : string|null
Return values
self —setDisplayName()
public
setDisplayName(string $displayName) : self
Parameters
- $displayName : string
Return values
self —setFirstName()
public
setFirstName(string $firstName) : self
Parameters
- $firstName : string
Return values
self —setInLanguage()
public
setInLanguage(string|null $inLanguage) : self
Parameters
- $inLanguage : string|null
Return values
self —setLastName()
public
setLastName(string $lastName) : self
Parameters
- $lastName : string
Return values
self —setOrganization()
public
setOrganization([OrganizationSchema|null $organization = null ]) : self
Parameters
- $organization : OrganizationSchema|null = null
Return values
self —setPotentialAction()
Set a "potentialAction" schema.
public
setPotentialAction([Schema|null $potentialAction = null ]) : self
Parameters
- $potentialAction : Schema|null = null
Tags
Return values
self —setPublisher()
Set the value of publisher.
public
setPublisher([OrganizationSchema|string|null $publisher = null ]) : self
Parameters
- $publisher : OrganizationSchema|string|null = null
Return values
self —setThumbnail()
Set the thumbnail URL.
public
setThumbnail([mixed $thumbnail = null ]) : self
Parameters
- $thumbnail : mixed = null
Return values
self —setUrl()
public
setUrl(string|null $url) : self
Parameters
- $url : string|null
Return values
self —toArray()
Returns the object's data into key value pairs based on the underlying schema.org entity structure.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —parameters()
protected
parameters() : ParameterBag
Return values
ParameterBag —imageToSchema()
Converts a Timber/Image object or string into an ImageSchema object.
private
imageToSchema(Image|string $image) : ImageSchema|null
Parameters
- $image : Image|string