diff options
| author | Daniel Weipert <git@mail.dweipert.de> | 2026-03-05 14:57:28 +0100 |
|---|---|---|
| committer | Daniel Weipert <git@mail.dweipert.de> | 2026-03-05 14:57:28 +0100 |
| commit | bd11271621bd3759cfd194ed0119c0dc28155fd0 (patch) | |
| tree | 319b4790d4e2b05513abf023732ed6fb0717f603 /matrix-specification/Events/ClientEvent.php | |
| parent | 2386148b8f048ba40d9f26cc97898bdcdc778ea2 (diff) | |
Diffstat (limited to 'matrix-specification/Events/ClientEvent.php')
| -rw-r--r-- | matrix-specification/Events/ClientEvent.php | 41 |
1 files changed, 32 insertions, 9 deletions
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; } } |
