REDROOM
PHP 8.1.33
Path:
Logout
Edit File
Size: 2.92 KB
Close
/home/jambtst2015/public_html/ida.com.ng/libraries/vendor/tobscure/json-api/src/Collection.php
Text
Base64
<?php /* * This file is part of JSON-API. * * (c) Toby Zerner <toby.zerner@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tobscure\JsonApi; class Collection implements ElementInterface { /** * @var array */ protected $resources = []; /** * Create a new collection instance. * * @param mixed $data * @param \Tobscure\JsonApi\SerializerInterface $serializer */ public function __construct($data, SerializerInterface $serializer) { $this->resources = $this->buildResources($data, $serializer); } /** * Convert an array of raw data to Resource objects. * * @param mixed $data * @param SerializerInterface $serializer * * @return \Tobscure\JsonApi\Resource[] */ protected function buildResources($data, SerializerInterface $serializer) { $resources = []; foreach ($data as $resource) { if (! ($resource instanceof Resource)) { $resource = new Resource($resource, $serializer); } $resources[] = $resource; } return $resources; } /** * {@inheritdoc} */ public function getResources() { return $this->resources; } /** * Set the resources array. * * @param array $resources * * @return void */ public function setResources($resources) { $this->resources = $resources; } /** * Request a relationship to be included for all resources. * * @param string|array $relationships * * @return $this */ public function with($relationships) { foreach ($this->resources as $resource) { $resource->with($relationships); } return $this; } /** * Request a relationship to be identified for all resources. * * @param string|array $relationships * * @return $this */ public function identify($relationships) { foreach ($this->resources as $resource) { $resource->identify($relationships); } return $this; } /** * Request a restricted set of fields. * * @param array|null $fields * * @return $this */ public function fields($fields) { foreach ($this->resources as $resource) { $resource->fields($fields); } return $this; } /** * {@inheritdoc} */ public function toArray() { return array_map(function (Resource $resource) { return $resource->toArray(); }, $this->resources); } /** * {@inheritdoc} */ public function toIdentifier() { return array_map(function (Resource $resource) { return $resource->toIdentifier(); }, $this->resources); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 12
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Exception
DIR
-
drwxr-xr-x
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
AbstractSerializer.php
2.08 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Collection.php
2.92 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Document.php
4.96 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ElementInterface.php
994 B
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ErrorHandler.php
1.31 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LinksTrait.php
3.24 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
MetaTrait.php
956 B
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Parameters.php
4.59 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Relationship.php
1.49 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Resource.php
8.79 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SerializerInterface.php
1.24 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Util.php
1.12 KB
lrw-r--r--
2024-11-22 17:53:12
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).