PHP Class FOF30\Hal\Document

See also: http://stateless.co/hal_specification.html
Afficher le fichier Open project: akeeba/fof Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( mixed $data = null ) Public constructor
addData ( stdClass $data, boolean $overwrite = true ) : void Add data to the document
addEmbedded ( string $rel, Document $document, boolean $overwrite = true ) : boolean Add an embedded document
addLink ( string $rel, Link $link, boolean $overwrite = true ) : boolean 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 | Document 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.

Method Details

__construct() public méthode

Public constructor
public __construct ( mixed $data = null )
$data mixed The data of the document (usually, the resource state)

addData() public méthode

Add data to the document
public addData ( stdClass $data, boolean $overwrite = true ) : void
$data stdClass The data to add
$overwrite boolean Should I overwrite existing data?
Résultat void

addEmbedded() public méthode

Add an embedded document
public addEmbedded ( string $rel, Document $document, boolean $overwrite = true ) : boolean
$rel string The relation of the embedded document to its container document
$document Document The document to add
$overwrite boolean Should I overwrite existing data with the same relation?
Résultat boolean

getData() public méthode

Return the data attached to this document
public getData ( ) : array | stdClass
Résultat array | stdClass

getEmbedded() public méthode

Returns the collection of embedded documents
public getEmbedded ( string $rel = null ) : array | Document
$rel string Optional; the relation to return the embedded documents for
Résultat array | Document

render() public méthode

Instantiate and call a suitable renderer class to render this document into the specified format.
public render ( string $format = 'json' ) : string
$format string The format to render the document into, e.g. 'json'
Résultat string The rendered document