REDROOM
PHP 8.1.33
Path:
Logout
Edit File
Size: 3.41 KB
Close
/home/jambtst2015/9jahookups.com/libraries/src/Document/JsonapiDocument.php
Text
Base64
<?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Document; \defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; use Tobscure\JsonApi\Document; use Tobscure\JsonApi\ElementInterface; /** * JsonapiDocument class, provides an easy interface to parse output in JSON-API format. * * @link http://www.jsonapi.org/ * @since 4.0.0 */ class JsonapiDocument extends JsonDocument implements \JsonSerializable { /** * The JsonApi Document object. * * @var Document * @since 4.0.0 */ protected $document; /** * Class constructor. * * @param array $options Associative array of options * * @since 4.0.0 */ public function __construct($options = array()) { parent::__construct($options); // Set mime type to JSON-API $this->_mime = 'application/vnd.api+json'; $this->_type = 'jsonapi'; if (\array_key_exists('api_document', $options) && $options['api_document'] instanceof Document) { $this->document = $options['api_document']; } else { $this->document = new Document; } } /** * Set the data object. * * @param ElementInterface $element Element interface. * * @return $this * * @since 4.0.0 */ public function setData(ElementInterface $element) { $this->document->setData($element); return $this; } /** * Set the errors array. * * @param array $errors Error array. * * @return $this * * @since 4.0.0 */ public function setErrors($errors) { $this->document->setErrors($errors); return $this; } /** * Set the JSON-API array. * * @param array $jsonapi JSON-API array. * * @return $this * * @since 4.0.0 */ public function setJsonapi($jsonapi) { $this->document->setJsonapi($jsonapi); return $this; } /** * Map everything to arrays. * * @return array * * @since 4.0.0 */ public function toArray() { return $this->document->toArray(); } /** * Map to string. * * @return string * * @since 4.0.0 */ public function __toString() { return json_encode($this->toArray()); } /** * Outputs the document. * * @param boolean $cache If true, cache the output. * @param array $params Associative array of attributes. * * @return string The rendered data. * * @since 4.0.0 */ public function render($cache = false, $params = array()) { $app = Factory::getApplication(); if ($mdate = $this->getModifiedDate()) { $app->modifiedDate = $mdate; } $app->mimeType = $this->_mime; $app->charSet = $this->_charset; return json_encode($this->document); } /** * Serialize for JSON usage. * * @return array * * @since 4.0.0 */ public function jsonSerialize() { return $this->toArray(); } /** * Add a link to the output. * * @param string $key The name of the link * @param string $value The link * * @return $this * * @since 4.0.0 */ public function addLink($key, $value) { $this->document->addLink($key, $value); return $this; } /** * Add a link to the output. * * @param string $key The name of the metadata key * @param string $value The value * * @return $this * * @since 4.0.0 */ public function addMeta($key, $value) { $this->document->addMeta($key, $value); return $this; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 3 × Files: 16
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Feed
DIR
-
drwxr-xr-x
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Opensearch
DIR
-
drwxr-xr-x
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Renderer
DIR
-
drwxr-xr-x
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Document.php
24.47 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DocumentRenderer.php
1.44 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ErrorDocument.php
3.22 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Factory.php
2.38 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FactoryInterface.php
1.14 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FeedDocument.php
4.24 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
HtmlDocument.php
21.04 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ImageDocument.php
1.42 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
JsonapiDocument.php
3.41 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
JsonDocument.php
2.20 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
OpensearchDocument.php
5.18 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PreloadManager.php
4.00 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PreloadManagerInterface.php
2.54 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RawDocument.php
1.06 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RendererInterface.php
753 B
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
XmlDocument.php
2.51 KB
lrw-r--r--
2021-08-23 19:07:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).