summaryrefslogtreecommitdiff
path: root/matrix-specification/Events/SenderEvent.php
blob: 86ba65eae3d3e13378dbace8613793209d4a9683 (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
33
34
<?php

namespace Matrix\Events;

use Matrix\Enums\EventType;

abstract class SenderEvent extends Event
{
  /**
   * @param array<string, mixed> $content
   */
  public function __construct(
    array $content,
    protected string $sender,
    EventType $type,
  )
  {
    parent::__construct($content, $type);
  }

  public function jsonSerialize(): array
  {
    return [
      "content" => $this->content,
      "sender" => $this->sender,
      "type" => $this->type,
    ];
  }

  public function getSender(): string
  {
    return $this->sender;
  }
}