function RuleExpression::addExpressionObject

Overrides ExpressionContainerInterface::addExpressionObject

1 call to RuleExpression::addExpressionObject()
RuleExpression::addExpression in src/Plugin/RulesExpression/RuleExpression.php
Creates and adds an expression.

File

src/Plugin/RulesExpression/RuleExpression.php, line 176

Class

RuleExpression
Provides a rule, executing actions when conditions are met.

Namespace

Drupal\rules\Plugin\RulesExpression

Code

public function addExpressionObject(ExpressionInterface $expression) {
    if ($expression instanceof ConditionExpressionInterface) {
        $this->conditions
            ->addExpressionObject($expression);
    }
    elseif ($expression instanceof ActionExpressionInterface) {
        $this->actions
            ->addExpressionObject($expression);
    }
    else {
        throw new InvalidExpressionException();
    }
    return $this;
}