PHP 8.1.33
Preview: Relationship.php Size: 1.49 KB
/home/jambtst2015/public_html/ida.com.ng/libraries/vendor/tobscure/json-api/src/Relationship.php

<?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 Relationship
{
    use LinksTrait;
    use MetaTrait;

    /**
     * The data object.
     *
     * @var \Tobscure\JsonApi\ElementInterface|null
     */
    protected $data;

    /**
     * Create a new relationship.
     *
     * @param \Tobscure\JsonApi\ElementInterface|null $data
     */
    public function __construct(ElementInterface $data = null)
    {
        $this->data = $data;
    }

    /**
     * Get the data object.
     *
     * @return \Tobscure\JsonApi\ElementInterface|null
     */
    public function getData()
    {
        return $this->data;
    }

    /**
     * Set the data object.
     *
     * @param \Tobscure\JsonApi\ElementInterface|null $data
     *
     * @return $this
     */
    public function setData($data)
    {
        $this->data = $data;

        return $this;
    }

    /**
     * Map everything to an array.
     *
     * @return array
     */
    public function toArray()
    {
        $array = [];

        if (! empty($this->data)) {
            $array['data'] = $this->data->toIdentifier();
        }

        if (! empty($this->meta)) {
            $array['meta'] = $this->meta;
        }

        if (! empty($this->links)) {
            $array['links'] = $this->links;
        }

        return $array;
    }
}

Directory Contents

Dirs: 1 × Files: 12

Name Size Perms Modified Actions
Exception DIR
- drwxr-xr-x 2024-11-22 17:53:12
Edit Download
2.08 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
2.92 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
4.96 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
994 B lrw-r--r-- 2024-11-22 17:53:12
Edit Download
1.31 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
3.24 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
956 B lrw-r--r-- 2024-11-22 17:53:12
Edit Download
4.59 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
1.49 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
8.79 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
1.24 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
1.12 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).