summaryrefslogtreecommitdiff
path: root/matrix-specification/Data/DiscoveryInformation.php
diff options
context:
space:
mode:
Diffstat (limited to 'matrix-specification/Data/DiscoveryInformation.php')
-rw-r--r--matrix-specification/Data/DiscoveryInformation.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/matrix-specification/Data/DiscoveryInformation.php b/matrix-specification/Data/DiscoveryInformation.php
new file mode 100644
index 0000000..f4eda64
--- /dev/null
+++ b/matrix-specification/Data/DiscoveryInformation.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Matrix\Data;
+
+class DiscoveryInformation implements \JsonSerializable
+{
+ /**
+ * @param array<string, array<mixed, mixed>> $otherProperties
+ */
+ public function __construct(
+ private HomeServerInformation $homeServerInformation,
+ private IdentityServerInformation $identityServerInformation,
+ private ?array $otherProperties = null,
+ )
+ {}
+
+ public function jsonSerialize(): array
+ {
+ return array_filter(
+ array_merge(
+ [
+ "m.homeserver" => $this->homeServerInformation,
+ "m.identity_server" => $this->identityServerInformation,
+ ],
+ $this->otherProperties ?? [],
+ ),
+ fn ($value) => ! is_null($value)
+ );
+ }
+}