From bd11271621bd3759cfd194ed0119c0dc28155fd0 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 5 Mar 2026 14:57:28 +0100 Subject: update --- matrix-specification/Events/ClientEvent.php | 41 ++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'matrix-specification/Events/ClientEvent.php') diff --git a/matrix-specification/Events/ClientEvent.php b/matrix-specification/Events/ClientEvent.php index be1e354..dda4ead 100644 --- a/matrix-specification/Events/ClientEvent.php +++ b/matrix-specification/Events/ClientEvent.php @@ -2,31 +2,54 @@ namespace Matrix\Events; +use Matrix\Data\UnsignedData; use Matrix\Enums\EventType; -class ClientEvent extends ClientEventWithoutRoomId +class ClientEvent extends SenderEvent { public function __construct( array $content, - string $eventId, - int $originServerTimestamp, + protected string $eventId, + protected int $originServerTimestamp, protected string $roomId, string $sender, - string $stateKey, EventType $type, - ?UnsignedData $unsigned = null, + protected ?UnsignedData $unsigned = null, ) { - parent::__construct($content, $eventId, $originServerTimestamp, $sender, $stateKey, $type); + parent::__construct($content, $sender, $type); } public function jsonSerialize(): array { - $clientEvent = parent::jsonSerialize(); - $clientEvent += [ + return [ + "content" => $this->content ?: new \stdClass, + "event_id" => $this->eventId, + "origin_server_ts" => $this->originServerTimestamp, "room_id" => $this->roomId, + "sender" => $this->sender, + "type" => $this->type, + "unsigned" => $this->unsigned ?? new \stdClass, ]; + } + + public function getId(): string + { + return $this->eventId; + } - return $clientEvent; + public function getOriginServerTimestamp(): int + { + return $this->originServerTimestamp; + } + + public function getRoomId(): string + { + return $this->roomId; + } + + public function getUnsigned(): ?UnsignedData + { + return $this->unsigned; } } -- cgit v1.2.3