function RulesAnd::evaluate

Overrides RulesPlugin::evaluate

File

includes/rules.plugins.inc, line 579

Class

RulesAnd
A logical AND.

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' => 'FALSE',
            ));
            return $this->negate;
        }
    }
    rules_log('%condition evaluated to %bool.', array(
        '%condition' => $this->label(),
        '%bool' => 'TRUE',
    ));
    return !$this->negate;
}