Back to Joomla project (class list)

Class JsonapiDocument - list of methods

JsonapiDocument class, provides an easy interface to parse output in JSON-API format.

Extends

Package: Joomla\CMS\Document
Copyright: (C) 2019 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE
Located at: Joomla/Document/JsonapiDocument.php
Project: Joomla

Method Summary

public
(mixed $options = array())

Class constructor.
Parameters
  • array $options Associative array of options
Since
  • 4.0.0
Show source code of this method: __construct Source Code

public $this
(\Tobscure\JsonApi\ElementInterface $element)

Set the data object.
Parameters
  • \Tobscure\JsonApi\ElementInterface $element Element interface.
Returns
  • $this
Since
  • 4.0.0
Show source code of this method: setData Source Code

public $this
(mixed $errors)

Set the errors array.
Parameters
  • array $errors Error array.
Returns
  • $this
Since
  • 4.0.0
Show source code of this method: setErrors Source Code

public $this
(mixed $jsonapi)

Set the JSON-API array.
Parameters
  • array $jsonapi JSON-API array.
Returns
  • $this
Since
  • 4.0.0
Show source code of this method: setJsonapi Source Code

public array
()

Map everything to arrays.
Returns
  • array
Since
  • 4.0.0
Show source code of this method: toArray Source Code

public string
()

Map to string.
Returns
  • string
Since
  • 4.0.0
Show source code of this method: __toString Source Code

public string
(mixed $cache = false, mixed $params = array())

Outputs the document.
Parameters
  • bool $cache If true, cache the output.
  • array $params Associative array of attributes.
Returns
  • string The rendered data.
Since
  • 4.0.0
Show source code of this method: render Source Code

public array
()

Serialize for JSON usage.
Returns
  • array
Since
  • 4.0.0
Show source code of this method: jsonSerialize Source Code

public $this
(mixed $key, mixed $value)

Add a link to the output.
Parameters
  • string $key The name of the link
  • string $value The link
Returns
  • $this
Since
  • 4.0.0
Show source code of this method: addLink Source Code

public $this
(mixed $key, mixed $value)

Add a link to the output.
Parameters
  • string $key The name of the metadata key
  • string $value The value
Returns
  • $this
Since
  • 4.0.0
Show source code of this method: addMeta Source Code

Properties Summary

protected \Tobscure\JsonApi\Document
$document
The JsonApi Document object.
Since
  • 4.0.0

Tags Summary

Since
4.0.0