public function DateRecurNonRecurringHelper::getOccurrences in Recurring Dates Field 3.1.x
Same name and namespace in other branches
- 8.2 src/DateRecurNonRecurringHelper.php \Drupal\date_recur\DateRecurNonRecurringHelper::getOccurrences()
- 3.x src/DateRecurNonRecurringHelper.php \Drupal\date_recur\DateRecurNonRecurringHelper::getOccurrences()
- 3.0.x src/DateRecurNonRecurringHelper.php \Drupal\date_recur\DateRecurNonRecurringHelper::getOccurrences()
Get all occurrences.
A limit and/or range-end must be passed.
Parameters
\DateTimeInterface|null $rangeStart: The start of the range, or start with the first available occurrence.
\DateTimeInterface|null $rangeEnd: The end of the range.
int|null $limit: A limit.
Return value
\Drupal\date_recur\DateRange[] The occurrences.
Throws
\InvalidArgumentException Exceptions thrown if ranges are invalid or undefined.
Overrides DateRecurHelperInterface::getOccurrences
File
- src/
DateRecurNonRecurringHelper.php, line 80
Class
- DateRecurNonRecurringHelper
- Dummy helper for handling non-recurring values.
Namespace
Drupal\date_recurCode
public function getOccurrences(\DateTimeInterface $rangeStart = NULL, ?\DateTimeInterface $rangeEnd = NULL, ?int $limit = NULL) : array {
if (isset($limit) && (!is_int($limit) || $limit < 0)) {
// Limit must be a number and more than one.
throw new \InvalidArgumentException('Invalid count limit.');
}
// There can either by zero or one occurrence generated for non-recurring
// generator.
if (isset($limit) && $limit === 0) {
return [];
}
return iterator_to_array($this
->generateOccurrences($rangeStart, $rangeEnd));
}