Method | Description | |
---|---|---|
__construct ( mixed $data = null ) | Public constructor | |
addData ( stdClass $data, boolean $overwrite = true ) : void | Add data to the document | |
addEmbedded ( string $rel, |
Add an embedded document | |
addLink ( string $rel, |
Add a link to the document | |
addLinks ( string $rel, array $links, boolean $overwrite = true ) : boolean | Add links to the document | |
getData ( ) : array | stdClass | Return the data attached to this document | |
getEmbedded ( string $rel = null ) : array | |
Returns the collection of embedded documents | |
getLinks ( string $rel = null ) : array | Returns the collection of links of this document | |
render ( string $format = 'json' ) : string | Instantiate and call a suitable renderer class to render this document into the specified format. |
public __construct ( mixed $data = null ) | ||
$data | mixed | The data of the document (usually, the resource state) |
public addLink ( string $rel, |
||
$rel | string | 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. |
$link | The actual link object | |
$overwrite | boolean | 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 | boolean | True if the link was added to the collection |
public addLinks ( string $rel, array $links, boolean $overwrite = true ) : boolean | ||
$rel | string | The relation of the link to the document. See RFC 5988 |
$links | array | An array of FOFHalLink objects |
$overwrite | boolean | 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 | boolean |
public getEmbedded ( string $rel = null ) : array | |
||
$rel | string | Optional; the relation to return the embedded documents for |
return | array | |