summaryrefslogtreecommitdiff
path: root/matrix-specification/Events/Room/TopicEvent.php
diff options
context:
space:
mode:
Diffstat (limited to 'matrix-specification/Events/Room/TopicEvent.php')
-rw-r--r--matrix-specification/Events/Room/TopicEvent.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/matrix-specification/Events/Room/TopicEvent.php b/matrix-specification/Events/Room/TopicEvent.php
new file mode 100644
index 0000000..8e01a3b
--- /dev/null
+++ b/matrix-specification/Events/Room/TopicEvent.php
@@ -0,0 +1,37 @@
+<?php
+
+namespace Matrix\Events\Room;
+
+use Matrix\Data\Room\TopicContentBlock;
+use Matrix\Data\UnsignedData;
+use Matrix\Enums\EventType;
+use Matrix\Events\StateEvent;
+
+class TopicEvent extends StateEvent
+{
+ public function __construct(
+ string $eventId,
+ int $originServerTimestamp,
+ string $roomId,
+ string $sender,
+ string $topic,
+ ?TopicContentBlock $topicContentBlock = null,
+ string $stateKey = "",
+ ?UnsignedData $unsigned = null,
+ )
+ {
+ parent::__construct(
+ array_filter([
+ "m.topic" => $topicContentBlock,
+ "topic" => $topic,
+ ], fn ($value) => ! is_null($value)),
+ $eventId,
+ $originServerTimestamp,
+ $roomId,
+ $sender,
+ $stateKey,
+ EventType::ROOM_TOPIC,
+ $unsigned,
+ );
+ }
+}