BroadcastEvent.php 868 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Broadcast\Events;
  8. use JsonSerializable;
  9. use OCP\Broadcast\Events\IBroadcastEvent;
  10. use OCP\EventDispatcher\ABroadcastedEvent;
  11. use OCP\EventDispatcher\Event;
  12. class BroadcastEvent extends Event implements IBroadcastEvent {
  13. /** @var ABroadcastedEvent */
  14. private $event;
  15. public function __construct(ABroadcastedEvent $event) {
  16. parent::__construct();
  17. $this->event = $event;
  18. }
  19. public function getName(): string {
  20. return $this->event->broadcastAs();
  21. }
  22. public function getUids(): array {
  23. return $this->event->getUids();
  24. }
  25. public function getPayload(): JsonSerializable {
  26. return $this->event;
  27. }
  28. public function setBroadcasted(): void {
  29. $this->event->setBroadcasted();
  30. }
  31. }