\FOFHalDocument
Implementation of the Hypertext Application Language document in PHP. It can be used to provide hypermedia in a web service context.
Synopsis
class FOFHalDocument
{
- // members
- private FOFHalLinks $_links;
- private $_data;
- private $_embedded;
- private $_dataKey;
- // methods
- public void __construct()
- public boolean addLink()
- public boolean addLinks()
- public void addData()
- public boolean addEmbedded()
- public array getLinks()
- public array|FOFHalDocument getEmbedded()
- public array|stdClass getData()
- public string render()
Members
private
- $_data
—
array
The data (resource state or collection of resource state objects) of the document. - $_dataKey
—
string
When $_data is an array we'll output the list of data under this key (JSON) or tag (XML) - $_embedded
—
array
Embedded documents. This is an array of FOFHalDocument instances. - $_links
—
FOFHalLinks
The collection of links of this document
Methods
public
- __construct() — Public constructor
- addData() — Add data to the document
- addEmbedded() — Add an embedded document
- addLink() — Add a link to the document
- addLinks() — Add links to the document
- getData() — Return the data attached to this document
- getEmbedded() — Returns the collection of embedded documents
- getLinks() — Returns the collection of links of this document
- render() — Instantiate and call a suitable renderer class to render this document into the specified format.