Files
piratepoet/mailpoet/lib/Automation/Engine/Data/Step.php
Jan Jakes 4aa323b612 Extract data-carrying classes to dedicated namespace
We need a separation of "Step" as an interface vs. "Step" as a serializable data structure.

[MAILPOET-4515]
2022-08-08 13:23:57 +02:00

72 lines
1.3 KiB
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Data;
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 */
protected $nextStepId;
/** @var array */
protected $args;
public function __construct(
string $id,
string $type,
string $key,
?string $nextStepId = null,
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 setNextStepId(string $id): void {
$this->nextStepId = $id;
}
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,
];
}
}