1
0

BeforeZipCreatedEvent.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2022 Carl Schwan <carl@carlschwan.eu>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OCP\Files\Events;
  23. use OCP\EventDispatcher\Event;
  24. /**
  25. * @since 25.0.0
  26. */
  27. class BeforeZipCreatedEvent extends Event {
  28. private string $directory;
  29. private array $files;
  30. private bool $successful = true;
  31. private ?string $errorMessage = null;
  32. /**
  33. * @since 25.0.0
  34. */
  35. public function __construct(string $directory, array $files) {
  36. parent::__construct();
  37. $this->directory = $directory;
  38. $this->files = $files;
  39. }
  40. /**
  41. * @since 25.0.0
  42. */
  43. public function getDirectory(): string {
  44. return $this->directory;
  45. }
  46. /**
  47. * @since 25.0.0
  48. */
  49. public function getFiles(): array {
  50. return $this->files;
  51. }
  52. /**
  53. * @since 25.0.0
  54. */
  55. public function isSuccessful(): bool {
  56. return $this->successful;
  57. }
  58. /**
  59. * Set if the event was successful
  60. *
  61. * @since 25.0.0
  62. */
  63. public function setSuccessful(bool $successful): void {
  64. $this->successful = $successful;
  65. }
  66. /**
  67. * Get the error message, if any
  68. * @since 25.0.0
  69. */
  70. public function getErrorMessage(): ?string {
  71. return $this->errorMessage;
  72. }
  73. /**
  74. * @since 25.0.0
  75. */
  76. public function setErrorMessage(string $errorMessage): void {
  77. $this->errorMessage = $errorMessage;
  78. }
  79. }