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
43
44
45
46
47
48
49
50
|
<?php
namespace Matrix\Data\Filters;
class RoomEventFilter extends EventFilter
{
/**
* @param string[] $notRooms
* @param string[] $notSenders
* @param string[] $notTypes
* @param string[] $rooms
* @param string[] $senders
* @param string[] $types
*/
public function __construct(
private ?bool $containsUrl = null,
private ?bool $includeRedundantMembers = null,
private ?bool $lazyLoadMembers = null,
?int $limit = null,
private ?array $notRooms = null,
?array $notSenders = null,
?array $notTypes = null,
private ?array $rooms = null,
?array $senders = null,
?array $types = null,
private ?bool $unreadThreadNotifications = null,
)
{
parent::__construct($limit, $notSenders, $notTypes, $senders, $types);
}
public function setDefaults(): void
{
$this->includeRedundantMembers ??= false;
$this->lazyLoadMembers ??= false;
$this->unreadThreadNotifications ??= false;
}
public function jsonSerialize(): array
{
return parent::jsonSerialize() + array_filter([
"contains_url" => $this->containsUrl,
"include_redundant_members" => $this->includeRedundantMembers,
"lazy_load_members" => $this->lazyLoadMembers,
"not_rooms" => $this->notRooms,
"rooms" => $this->rooms,
"unread_thread_notifications" => $this->unreadThreadNotifications,
], fn ($value) => ! is_null($value));
}
}
|