1
0

OutOfOfficeData.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 OC\User;
  8. use OCP\IUser;
  9. use OCP\User\IOutOfOfficeData;
  10. class OutOfOfficeData implements IOutOfOfficeData {
  11. public function __construct(
  12. private string $id,
  13. private IUser $user,
  14. private int $startDate,
  15. private int $endDate,
  16. private string $shortMessage,
  17. private string $message,
  18. private ?string $replacementUserId,
  19. private ?string $replacementUserDisplayName,
  20. ) {
  21. }
  22. public function getId(): string {
  23. return $this->id;
  24. }
  25. public function getUser(): IUser {
  26. return $this->user;
  27. }
  28. public function getStartDate(): int {
  29. return $this->startDate;
  30. }
  31. public function getEndDate(): int {
  32. return $this->endDate;
  33. }
  34. public function getShortMessage(): string {
  35. return $this->shortMessage;
  36. }
  37. public function getMessage(): string {
  38. return $this->message;
  39. }
  40. public function getReplacementUserId(): ?string {
  41. return $this->replacementUserId;
  42. }
  43. public function getReplacementUserDisplayName(): ?string {
  44. return $this->replacementUserDisplayName;
  45. }
  46. public function jsonSerialize(): array {
  47. return [
  48. 'id' => $this->getId(),
  49. 'userId' => $this->getUser()->getUID(),
  50. 'startDate' => $this->getStartDate(),
  51. 'endDate' => $this->getEndDate(),
  52. 'shortMessage' => $this->getShortMessage(),
  53. 'message' => $this->getMessage(),
  54. 'replacementUserId' => $this->getReplacementUserId(),
  55. 'replacementUserDisplayName' => $this->getReplacementUserDisplayName(),
  56. ];
  57. }
  58. }