summaryrefslogtreecommitdiffstats
path: root/vendor/gipfl/openrpc/src/Reference.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gipfl/openrpc/src/Reference.php')
-rw-r--r--vendor/gipfl/openrpc/src/Reference.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/gipfl/openrpc/src/Reference.php b/vendor/gipfl/openrpc/src/Reference.php
new file mode 100644
index 0000000..e954293
--- /dev/null
+++ b/vendor/gipfl/openrpc/src/Reference.php
@@ -0,0 +1,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];
+ }
+}