You are here

public function RlHelper::getRules in Recurring Dates Field 3.x

Same name and namespace in other branches
  1. 8.2 src/Rl/RlHelper.php \Drupal\date_recur\Rl\RlHelper::getRules()
  2. 3.0.x src/Rl/RlHelper.php \Drupal\date_recur\Rl\RlHelper::getRules()
  3. 3.1.x src/Rl/RlHelper.php \Drupal\date_recur\Rl\RlHelper::getRules()

Get the rules that comprise this helper.

Return value

\Drupal\date_recur\DateRecurRuleInterface[] The rules that comprise this helper.

Overrides DateRecurHelperInterface::getRules

File

src/Rl/RlHelper.php, line 130

Class

RlHelper
Helper for recurring rules implemented with rlanvin/rrule.

Namespace

Drupal\date_recur\Rl

Code

public function getRules() : array {
  return array_map(function (RRule $rule) : RlDateRecurRule {

    // RL returns all parts, even if no values originally provided. Filter
    // out the useless parts.
    $parts = array_filter($rule
      ->getRule());
    return new RlDateRecurRule($parts);
  }, $this->set
    ->getRRules());
}