diff options
| author | Daniel Weipert <git@mail.dweipert.de> | 2025-09-25 13:38:24 +0200 |
|---|---|---|
| committer | Daniel Weipert <git@mail.dweipert.de> | 2025-09-25 13:38:24 +0200 |
| commit | b19a8f63ad727a3633885d3f2b81edf8181a53b9 (patch) | |
| tree | 6b5fd70224a125a16010a291e5fd0df834e9436f /matrix-specification/Data/Filters/RoomEventFilter.php | |
| parent | b08047ba485f86038f33175162943c0a9878ab1a (diff) | |
matrix-specification split work in progress
Diffstat (limited to 'matrix-specification/Data/Filters/RoomEventFilter.php')
| -rw-r--r-- | matrix-specification/Data/Filters/RoomEventFilter.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/matrix-specification/Data/Filters/RoomEventFilter.php b/matrix-specification/Data/Filters/RoomEventFilter.php new file mode 100644 index 0000000..915c9a0 --- /dev/null +++ b/matrix-specification/Data/Filters/RoomEventFilter.php @@ -0,0 +1,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, + ], "is_null"); + } +} |
