BeforePreviewFetchedEvent.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Preview;
  8. use OCP\Files\Node;
  9. use OCP\IPreview;
  10. /**
  11. * @since 25.0.1
  12. */
  13. class BeforePreviewFetchedEvent extends \OCP\EventDispatcher\Event {
  14. /**
  15. * @since 25.0.1
  16. */
  17. public function __construct(
  18. private Node $node,
  19. /** @deprecated 28.0.0 null deprecated **/
  20. private ?int $width = null,
  21. /** @deprecated 28.0.0 null deprecated **/
  22. private ?int $height = null,
  23. /** @deprecated 28.0.0 null deprecated **/
  24. private ?bool $crop = null,
  25. /** @deprecated 28.0.0 null deprecated **/
  26. private ?string $mode = null,
  27. ) {
  28. parent::__construct();
  29. }
  30. /**
  31. * @since 25.0.1
  32. */
  33. public function getNode(): Node {
  34. return $this->node;
  35. }
  36. /**
  37. * @since 28.0.0
  38. */
  39. public function getWidth(): ?int {
  40. return $this->width;
  41. }
  42. /**
  43. * @since 28.0.0
  44. */
  45. public function getHeight(): ?int {
  46. return $this->height;
  47. }
  48. /**
  49. * @since 28.0.0
  50. */
  51. public function isCrop(): ?bool {
  52. return $this->crop;
  53. }
  54. /**
  55. * @since 28.0.0
  56. * @return null|IPreview::MODE_FILL|IPreview::MODE_COVER
  57. */
  58. public function getMode(): ?string {
  59. return $this->mode;
  60. }
  61. }