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
35
36
37
38
39
40
41
42
|
<?php
namespace Matrix\Events;
use Matrix\Enums\EventType;
use Matrix\Enums\PresenceState;
class PresenceEvent extends SenderEvent
{
public function __construct(
string $sender,
PresenceState $presence,
?string $avatarUrl = null,
?bool $currentlyActive = null,
?string $displayName = null,
?int $lastActiveAgo = null,
?string $statusMessage = null,
)
{
parent::__construct(
array_filter([
"avatar_url" => $avatarUrl,
"currently_active" => $currentlyActive,
"display_name" => $displayName,
"last_active_ago" => $lastActiveAgo,
"presence" => $presence,
"status_msg" => $statusMessage,
], "is_null"),
$sender,
EventType::PRESENCE
);
}
public function jsonSerialize(): array
{
return [
"content" => $this->content,
"sender" => $this->sender,
"type" => $this->type,
];
}
}
|