Public constructor
FOFHalDocument
__construct
([mixed $data = null])
-
mixed
$data: The data of the document (usually, the resource state)
Add data to the document
void
addData
(stdClass $data, [boolean $overwrite = true])
-
stdClass
$data: The data to add
-
boolean
$overwrite: Should I overwrite existing data?
Add an embedded document
boolean
addEmbedded
(
string $rel,
FOFHalDocument $document, [
boolean $overwrite =
true])
-
string
$rel: The relation of the embedded document to its container document
-
FOFHalDocument
$document: The document to add
-
boolean
$overwrite: Should I overwrite existing data with the same relation?
Add a link to the document
boolean
addLink
(
string $rel,
FOFHalLink $link, [
boolean $overwrite =
true])
-
string
$rel: The relation of the link to the document. See RFC 5988 http://tools.ietf.org/html/rfc5988#section-6.2.2 A document MUST always have a "self" link.
-
FOFHalLink
$link: The actual link object
-
boolean
$overwrite: When false and a link of $rel relation exists, an array of links is created. Otherwise the existing link is overwriten with the new one
Add links to the document
boolean
addLinks
(string $rel, array $links, [boolean $overwrite = true])
-
string
$rel: The relation of the link to the document. See RFC 5988
-
array
$links: An array of FOFHalLink objects
-
boolean
$overwrite: When false and a link of $rel relation exists, an array of links is created. Otherwise the existing link is overwriten with the new one
Return the data attached to this document
array|stdClass
getData
()
Returns the collection of embedded documents
-
string
$rel: Optional; the relation to return the embedded documents for
Returns the collection of links of this document
array
getLinks
([string $rel = null])
-
string
$rel: The relation of the links to fetch. Skip to get all links.
Instantiate and call a suitable renderer class to render this document into the specified format.
string
render
([string $format = 'json'])
-
string
$format: The format to render the document into, e.g. 'json'