summaryrefslogtreecommitdiffstats
path: root/vendor/gipfl/openrpc/src/Reference.php
blob: e9542932a912a26e6b6f5b2de4d4fd78984025e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

namespace gipfl\OpenRpc;

use JsonSerializable;

/**
 * A simple object to allow referencing other components in the specification,
 * internally and externally.
 *
 * The Reference Object is defined by JSON Schema and follows the same structure,
 * behavior and rules.
 */
class Reference implements JsonSerializable
{
    /** @var string REQUIRED. The reference string */
    public $ref;

    /**
     * @param string $ref
     */
    public function __construct($ref)
    {
        $this->ref = $ref;
    }

    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
       return (object) ['$ref' => $this->ref];
    }
}