1
0

AMetadataEvent.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\FilesMetadata;
  8. use OCP\EventDispatcher\Event;
  9. use OCP\Files\Node;
  10. use OCP\FilesMetadata\Model\IFilesMetadata;
  11. /**
  12. * @since 28.0.0
  13. */
  14. abstract class AMetadataEvent extends Event {
  15. /**
  16. * @param Node $node
  17. * @param IFilesMetadata $metadata
  18. * @since 28.0.0
  19. */
  20. public function __construct(
  21. protected Node $node,
  22. protected IFilesMetadata $metadata
  23. ) {
  24. parent::__construct();
  25. }
  26. /**
  27. * returns related node
  28. *
  29. * @return Node
  30. * @since 28.0.0
  31. */
  32. public function getNode(): Node {
  33. return $this->node;
  34. }
  35. /**
  36. * returns metadata. if known, it already contains data from the database.
  37. * If the object is modified using its setters, changes are stored in database at the end of the event.
  38. *
  39. * @return IFilesMetadata
  40. * @since 28.0.0
  41. */
  42. public function getMetadata(): IFilesMetadata {
  43. return $this->metadata;
  44. }
  45. }