1
0

ABroadcastedEvent.php 924 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 OCP\EventDispatcher;
  8. use JsonSerializable;
  9. /**
  10. * @since 18.0.0
  11. */
  12. abstract class ABroadcastedEvent extends Event implements JsonSerializable {
  13. /**
  14. * @since 18.0.0
  15. */
  16. private $broadcasted = false;
  17. /**
  18. * Get the name of the event, as received on the client-side
  19. *
  20. * Uses the fully qualified event class name by default
  21. *
  22. * @return string
  23. * @since 18.0.0
  24. */
  25. public function broadcastAs(): string {
  26. return get_class($this);
  27. }
  28. /**
  29. * @return string[]
  30. * @since 18.0.0
  31. */
  32. abstract public function getUids(): array;
  33. /**
  34. * @since 18.0.0
  35. */
  36. public function setBroadcasted(): void {
  37. $this->broadcasted = true;
  38. }
  39. /**
  40. * @since 18.0.0
  41. */
  42. public function isBroadcasted(): bool {
  43. return $this->broadcasted;
  44. }
  45. }