EventReaderRDate.php 673 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\CalDAV;
  8. use DateTime;
  9. class EventReaderRDate extends \Sabre\VObject\Recur\RDateIterator {
  10. public function concludes(): ?DateTime {
  11. return $this->concludesOn();
  12. }
  13. public function concludesAfter(): ?int {
  14. return !empty($this->dates) ? count($this->dates) : null;
  15. }
  16. public function concludesOn(): ?DateTime {
  17. if (count($this->dates) > 0) {
  18. return new DateTime(
  19. $this->dates[array_key_last($this->dates)],
  20. $this->startDate->getTimezone()
  21. );
  22. }
  23. return null;
  24. }
  25. }