/** * {@inheritdoc} */ public function addExpressionObject(ExpressionInterface $expression) { if (!$expression instanceof ActionExpressionInterface) { throw new InvalidExpressionException('Only action expressions can be added to an action container.'); } if ($this->getExpression($expression->getUuid())) { throw new InvalidExpressionException('An action with the same UUID already exists in the container.'); } $this->actions[] = $expression; return $this; }
/** * {@inheritdoc} */ public function prepareExecutionMetadataState(ExecutionMetadataStateInterface $metadata_state, ExpressionInterface $until = NULL, $apply_assertions = TRUE) { if ($until && $this->getUuid() === $until->getUuid()) { return TRUE; } $this->prepareExecutionMetadataStateBeforeTraversal($metadata_state); $apply_assertions = $apply_assertions && $this->allowsMetadataAssertions(); foreach ($this as $child_expression) { $found = $child_expression->prepareExecutionMetadataState($metadata_state, $until, $apply_assertions); // If the expression was found, we need to stop. if ($found) { return TRUE; } } $this->prepareExecutionMetadataStateAfterTraversal($metadata_state); }
/** * {@inheritdoc} */ public function prepareExecutionMetadataState(ExecutionMetadataStateInterface $metadata_state, ExpressionInterface $until = NULL, $apply_assertions = TRUE) { if ($until && $this->getUuid() === $until->getUuid()) { return TRUE; } $action = $this->actionManager->createInstance($this->configuration['action_id']); // Make sure to refine context first, such that possibly refined definitions // of provided context are respected. $this->prepareContextWithMetadata($action, $metadata_state); $this->addProvidedContextDefinitions($action, $metadata_state); if ($apply_assertions) { $this->assertMetadata($action, $metadata_state); } }