public function getNextOccurrence($occurDate, $strictly_after = true)
{
self::prepareDateElements(false);
if (!$strictly_after) {
if ($this->occursOn($occurDate) && $this->occursAt($occurDate)) {
return $occurDate;
}
}
// Set an arbitrary end date, taking the 400Y advice from elsewhere in this module.
// TODO: do this in smaller chunks so we don't get a bunch of unneeded occurrences
$endDate = clone $occurDate;
$endDate->add(new \DateInterval('P400Y'));
$candidates = $this->getOccurrencesBetween($occurDate, $endDate, 2);
foreach ($candidates as $candidate) {
if (!$strictly_after) {
return $candidate;
} elseif ($candidate > $occurDate) {
return $candidate;
}
}
return false;
}