You are here

interface DateRecurHelperInterface in Recurring Dates Field 3.0.x

Same name and namespace in other branches
  1. 8.2 src/DateRecurHelperInterface.php \Drupal\date_recur\DateRecurHelperInterface
  2. 3.x src/DateRecurHelperInterface.php \Drupal\date_recur\DateRecurHelperInterface
  3. 3.1.x src/DateRecurHelperInterface.php \Drupal\date_recur\DateRecurHelperInterface

Interface for recurring rule helper.

@method DateRange current()

Hierarchy

Expanded class hierarchy of DateRecurHelperInterface

All classes that implement DateRecurHelperInterface

2 files declare their use of DateRecurHelperInterface
DateRecurItem.php in src/Plugin/Field/FieldType/DateRecurItem.php
RlHelper.php in src/Rl/RlHelper.php

File

src/DateRecurHelperInterface.php, line 12

Namespace

Drupal\date_recur
View source
interface DateRecurHelperInterface extends \Iterator {

  /**
   * Create a new instance.
   *
   * @param string $string
   *   The repeat rule.
   * @param \DateTimeInterface $dtStart
   *   The initial occurrence start date.
   * @param \DateTimeInterface|null $dtStartEnd
   *   The initial occurrence end date, or NULL to use start date.
   *
   * @return \Drupal\date_recur\DateRecurHelperInterface
   *   An instance of helper.
   */
  public static function createInstance(string $string, \DateTimeInterface $dtStart, ?\DateTimeInterface $dtStartEnd = NULL) : DateRecurHelperInterface;

  /**
   * Get the rules that comprise this helper.
   *
   * @return \Drupal\date_recur\DateRecurRuleInterface[]
   *   The rules that comprise this helper.
   */
  public function getRules() : array;

  /**
   * Determine whether this is infinite.
   *
   * @return bool
   *   Whether this is infinite.
   */
  public function isInfinite() : bool;

  /**
   * Calculates occurrences as a generator.
   *
   * @param \DateTimeInterface|null $rangeStart
   *   The start of the range, or start with the first available occurrence.
   * @param \DateTimeInterface|null $rangeEnd
   *   The end of the range, or never end.
   *
   * @return \Generator|\Drupal\date_recur\DateRange[]
   *   A date range generator.
   */
  public function generateOccurrences(?\DateTimeInterface $rangeStart = NULL, ?\DateTimeInterface $rangeEnd = NULL) : \Generator;

  /**
   * Get all occurrences.
   *
   * A limit and/or range-end must be passed.
   *
   * @param \DateTimeInterface|null $rangeStart
   *   The start of the range, or start with the first available occurrence.
   * @param \DateTimeInterface|null $rangeEnd
   *   The end of the range.
   * @param int|null $limit
   *   A limit.
   *
   * @return \Drupal\date_recur\DateRange[]
   *   The occurrences.
   *
   * @throws \InvalidArgumentException
   *   Exceptions thrown if ranges are invalid or undefined.
   */
  public function getOccurrences(\DateTimeInterface $rangeStart = NULL, ?\DateTimeInterface $rangeEnd = NULL, ?int $limit = NULL) : array;

  /**
   * Get excluded dates.
   *
   * Excluded dates are intended to match the start date of occurrences.
   * Excluded dates may not necessarily intersect with occurrences. Excluded
   * dates in the same time zone as the initial dates.
   *
   * Implementors of this method are responsible for ensuring time zone is
   * normalised.
   *
   * @return \DateTimeInterface[]
   *   An array of excluded dates.
   */
  public function getExcluded() : array;

}

Members

Namesort descending Modifiers Type Description Overrides
DateRecurHelperInterface::createInstance public static function Create a new instance. 3
DateRecurHelperInterface::generateOccurrences public function Calculates occurrences as a generator. 3
DateRecurHelperInterface::getExcluded public function Get excluded dates. 3
DateRecurHelperInterface::getOccurrences public function Get all occurrences. 3
DateRecurHelperInterface::getRules public function Get the rules that comprise this helper. 3
DateRecurHelperInterface::isInfinite public function Determine whether this is infinite. 3