PHP Класс FOF30\Hal\Document

См. также: http://stateless.co/hal_specification.html
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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.

Описание методов

__construct() публичный Метод

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

addData() публичный Метод

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?
Результат void

addEmbedded() публичный Метод

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?
Результат boolean

getData() публичный Метод

Return the data attached to this document
public getData ( ) : array | stdClass
Результат array | stdClass

getEmbedded() публичный Метод

Returns the collection of embedded documents
public getEmbedded ( string $rel = null ) : array | Document
$rel string Optional; the relation to return the embedded documents for
Результат array | Document

render() публичный Метод

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'
Результат string The rendered document