You are here

public function RulesOr::evaluate in Rules 7.2

Evaluate the element on a given rules evaluation state.

Overrides RulesPlugin::evaluate

File

includes/rules.plugins.inc, line 612
Contains plugin info and implementations not needed for rule evaluation.

Class

RulesOr
A logical OR.

Code

public function evaluate(RulesState $state) {
  foreach ($this->children as $condition) {
    if ($condition
      ->evaluate($state)) {
      rules_log('%condition evaluated to %bool.', array(
        '%condition' => $this
          ->label(),
        '%bool' => 'TRUE',
      ));
      return !$this->negate;
    }
  }
  rules_log('%condition evaluated to %bool.', array(
    '%condition' => $this
      ->label(),
    '%bool' => 'FALSE',
  ));
  return $this->negate;
}