summaryrefslogtreecommitdiff
path: root/matrix-specification/Events/ClientEvent.php
diff options
context:
space:
mode:
Diffstat (limited to 'matrix-specification/Events/ClientEvent.php')
-rw-r--r--matrix-specification/Events/ClientEvent.php41
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;
}
}