You are here

protected function RulesConditionalSwitch::selectBranches in Conditional Rules 7

Same name and namespace in other branches
  1. 8 includes/rules_conditional.plugin.inc \RulesConditionalSwitch::selectBranches()

Selects the branches to evaluate for this conditional.

Parameters

RulesState $state: Rules state to use.

Return value

RulesConditionalElement[] An array of branches to evaluate.

Overrides RulesConditionalContainer::selectBranches

File

includes/rules_conditional.plugin.inc, line 215
Rules plugin implementation.

Class

RulesConditionalSwitch
Switch conditional container.

Code

protected function selectBranches(RulesState $state) {
  $branches = array();

  // Collect all cases to be evaluated.
  $fallThrough = FALSE;
  foreach ($this->children as $case) {

    /** @var $case RulesConditionalCase */
    if ($case
      ->canEvaluate($state)) {
      $branches[] = $case;
    }
  }
  return $branches;
}