From b742a394b256cbafec7a8cafa25f44aecd3a808a Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Mon, 7 Mar 2022 11:26:37 +0100 Subject: [PATCH] Add workflow step data definition [MAILPOET-4136] --- .../lib/Automation/Engine/Workflows/Step.php | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/mailpoet/lib/Automation/Engine/Workflows/Step.php b/mailpoet/lib/Automation/Engine/Workflows/Step.php index 7b1271e34d..fc19f7ef3d 100644 --- a/mailpoet/lib/Automation/Engine/Workflows/Step.php +++ b/mailpoet/lib/Automation/Engine/Workflows/Step.php @@ -5,4 +5,63 @@ namespace MailPoet\Automation\Engine\Workflows; class Step { public const TYPE_TRIGGER = 'trigger'; public const TYPE_ACTION = 'action'; + + /** @var string */ + private $id; + + /** @var string */ + private $type; + + /** @var string */ + private $key; + + /** @var string|null */ + private $nextStepId; + + /** @var array */ + private $args; + + public function __construct( + string $id, + string $type, + string $key, + ?string $nextStepId, + array $args = [] + ) { + $this->id = $id; + $this->type = $type; + $this->key = $key; + $this->nextStepId = $nextStepId; + $this->args = $args; + } + + public function getId(): string { + return $this->id; + } + + public function getType(): string { + return $this->type; + } + + public function getKey(): string { + return $this->key; + } + + public function getNextStepId(): ?string { + return $this->nextStepId; + } + + public function getArgs(): array { + return $this->args; + } + + public function toArray(): array { + return [ + 'id' => $this->id, + 'type' => $this->type, + 'key' => $this->key, + 'next_step_id' => $this->nextStepId, + 'args' => $this->args, + ]; + } }