AtLeastOneTriggerRule.php
3 years ago
ConsistentStepMapRule.php
3 years ago
NoCycleRule.php
2 years ago
NoDuplicateEdgesRule.php
2 years ago
NoJoinRule.php
2 years ago
NoUnreachableStepsRule.php
2 years ago
TriggerNeedsToBeFollowedByActionRule.php
2 years ago
TriggersUnderRootRule.php
2 years ago
UnknownStepRule.php
3 years ago
ValidStepArgsRule.php
3 years ago
ValidStepFiltersRule.php
2 years ago
ValidStepOrderRule.php
3 years ago
ValidStepRule.php
2 months ago
ValidStepValidationRule.php
3 years ago
index.php
3 years ago
NoDuplicateEdgesRule.php
32 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\Automation\Engine\Validation\AutomationRules; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Automation\Engine\Data\Automation; |
| 9 | use MailPoet\Automation\Engine\Exceptions; |
| 10 | use MailPoet\Automation\Engine\Validation\AutomationGraph\AutomationNode; |
| 11 | use MailPoet\Automation\Engine\Validation\AutomationGraph\AutomationNodeVisitor; |
| 12 | |
| 13 | class NoDuplicateEdgesRule implements AutomationNodeVisitor { |
| 14 | public const RULE_ID = 'no-duplicate-edges'; |
| 15 | |
| 16 | public function initialize(Automation $automation): void { |
| 17 | } |
| 18 | |
| 19 | public function visitNode(Automation $automation, AutomationNode $node): void { |
| 20 | $visitedNextStepIdsMap = []; |
| 21 | foreach ($node->getStep()->getNextStepIds() as $nextStepId) { |
| 22 | if (isset($visitedNextStepIdsMap[$nextStepId])) { |
| 23 | throw Exceptions::automationStructureNotValid(__('Duplicate next step definition found', 'mailpoet'), self::RULE_ID); |
| 24 | } |
| 25 | $visitedNextStepIdsMap[$nextStepId] = true; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | public function complete(Automation $automation): void { |
| 30 | } |
| 31 | } |
| 32 |