Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / calendar / parser / data / PhutilCalendarRecurrenceList.php
blob4cbae54ac5096349f7d1871ab99175808fe42e4c
1 <?php
3 final class PhutilCalendarRecurrenceList
4 extends PhutilCalendarRecurrenceSource {
6 private $dates = array();
7 private $order;
9 public function setDates(array $dates) {
10 assert_instances_of($dates, 'PhutilCalendarDateTime');
11 $this->dates = $dates;
12 return $this;
15 public function getDates() {
16 return $this->dates;
19 public function resetSource() {
20 foreach ($this->getDates() as $date) {
21 $date->setViewerTimezone($this->getViewerTimezone());
24 $order = msort($this->getDates(), 'getEpoch');
25 $order = array_reverse($order);
26 $this->order = $order;
28 return $this;
31 public function getNextEvent($cursor) {
32 while ($this->order) {
33 $next = array_pop($this->order);
34 if ($next->getEpoch() >= $cursor) {
35 return $next;
39 return null;