OutOfOfficeData.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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(private string $id,
  12. private IUser $user,
  13. private int $startDate,
  14. private int $endDate,
  15. private string $shortMessage,
  16. private string $message) {
  17. }
  18. public function getId(): string {
  19. return $this->id;
  20. }
  21. public function getUser(): IUser {
  22. return $this->user;
  23. }
  24. public function getStartDate(): int {
  25. return $this->startDate;
  26. }
  27. public function getEndDate(): int {
  28. return $this->endDate;
  29. }
  30. public function getShortMessage(): string {
  31. return $this->shortMessage;
  32. }
  33. public function getMessage(): string {
  34. return $this->message;
  35. }
  36. public function jsonSerialize(): array {
  37. return [
  38. 'id' => $this->getId(),
  39. 'userId' => $this->getUser()->getUID(),
  40. 'startDate' => $this->getStartDate(),
  41. 'endDate' => $this->getEndDate(),
  42. 'shortMessage' => $this->getShortMessage(),
  43. 'message' => $this->getMessage(),
  44. ];
  45. }
  46. }