summaryrefslogtreecommitdiff
path: root/matrix-specification/Events/ClientEvent.php
blob: be1e3546f6c6a64935e7372e228bb8fb22265506 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

namespace Matrix\Events;

use Matrix\Enums\EventType;

class ClientEvent extends ClientEventWithoutRoomId
{
  public function __construct(
    array $content,
    string $eventId,
    int $originServerTimestamp,
    protected string $roomId,
    string $sender,
    string $stateKey,
    EventType $type,
    ?UnsignedData $unsigned = null,
  )
  {
    parent::__construct($content, $eventId, $originServerTimestamp, $sender, $stateKey, $type);
  }

  public function jsonSerialize(): array
  {
    $clientEvent = parent::jsonSerialize();
    $clientEvent += [
      "room_id" => $this->roomId,
    ];

    return $clientEvent;
  }
}