BeforeZipCreatedEvent.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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\Files\Events;
  8. use OCP\EventDispatcher\Event;
  9. /**
  10. * @since 25.0.0
  11. */
  12. class BeforeZipCreatedEvent extends Event {
  13. private string $directory;
  14. private array $files;
  15. private bool $successful = true;
  16. private ?string $errorMessage = null;
  17. /**
  18. * @since 25.0.0
  19. */
  20. public function __construct(string $directory, array $files) {
  21. parent::__construct();
  22. $this->directory = $directory;
  23. $this->files = $files;
  24. }
  25. /**
  26. * @since 25.0.0
  27. */
  28. public function getDirectory(): string {
  29. return $this->directory;
  30. }
  31. /**
  32. * @since 25.0.0
  33. */
  34. public function getFiles(): array {
  35. return $this->files;
  36. }
  37. /**
  38. * @since 25.0.0
  39. */
  40. public function isSuccessful(): bool {
  41. return $this->successful;
  42. }
  43. /**
  44. * Set if the event was successful
  45. *
  46. * @since 25.0.0
  47. */
  48. public function setSuccessful(bool $successful): void {
  49. $this->successful = $successful;
  50. }
  51. /**
  52. * Get the error message, if any
  53. * @since 25.0.0
  54. */
  55. public function getErrorMessage(): ?string {
  56. return $this->errorMessage;
  57. }
  58. /**
  59. * @since 25.0.0
  60. */
  61. public function setErrorMessage(string $errorMessage): void {
  62. $this->errorMessage = $errorMessage;
  63. }
  64. }