Add consisten steps map rule for workflow validation

[MAILPOET-4629]
This commit is contained in:
Jan Jakes
2022-09-14 15:11:36 +02:00
committed by David Remer
parent 0aa4cd4863
commit 11a711e42c
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Validation\WorkflowRules;
use MailPoet\Automation\Engine\Data\Workflow;
use MailPoet\Automation\Engine\Exceptions;
use MailPoet\Automation\Engine\Validation\WorkflowGraph\WorkflowNode;
use MailPoet\Automation\Engine\Validation\WorkflowGraph\WorkflowNodeVisitor;
class ConsistentStepMapRule implements WorkflowNodeVisitor {
public function initialize(Workflow $workflow): void {
foreach ($workflow->getSteps() as $id => $step) {
if ($id !== $step->getId()) {
throw Exceptions::workflowStructureNotValid(__('TODO', 'mailpoet'));
}
}
}
public function visitNode(Workflow $workflow, WorkflowNode $node): void {
}
public function complete(Workflow $workflow): void {
}
}