Wraps a single record from the remote CultureHosts API with some convenient helper methods.
Located at culturehosts-helper/src/Record.php
| Methods |
public
|
__construct(string $type, object $data)
Parameters
| $type |
The name of the endpoint this record was fetched from.
|
| $data |
The record object, as it is when JSON-decoded from the API.
|
|
#
|
public
|
get_type(): string
Get the CultureHosts endpoint this record was fetched from
Get the CultureHosts endpoint this record was fetched from
|
#
|
public
|
the_field(string $key): void
Echo the value of a field in the record. Value is html-escaped before output.
Echo the value of a field in the record. Value is html-escaped before output.
Parameters
| $key |
The CultureHosts field name
|
|
#
|
public
|
the_attribute(string $key): void
Echo the value of a field in the record. Value is attribute-escaped before output.
Echo the value of a field in the record. Value is attribute-escaped before output.
Parameters
| $key |
The CultureHosts field name
|
|
#
|
public
|
get_field(string $key): mixed
Get the value of a field in the record.
Get the value of a field in the record.
Parameters
| $key |
The CultureHosts field name
|
Returns
|
#
|
public
|
jsonSerialize(): stdClass
|
#
|
public
|
to_array(): array
Output the Record as an associative array.
Output the Record as an associative array.
|
#
|
| Properties |
public
readonly
|
string
|
$type
The name of the endpoint this record was fetched from.
The name of the endpoint this record was fetched from.
|
#
|