Server IP : 104.21.14.103 / Your IP : 3.129.250.144 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Automation/Engine/Data/ |
Upload File : |
<?php declare(strict_types = 1); namespace MailPoet\Automation\Engine\Data; if (!defined('ABSPATH')) exit; class Step { public const TYPE_ROOT = 'root'; public const TYPE_TRIGGER = 'trigger'; public const TYPE_ACTION = 'action'; /** @var string */ private $id; /** @var string */ private $type; /** @var string */ private $key; /** @var array */ protected $args; /** @var NextStep[] */ protected $nextSteps; /** @var Filters|null */ private $filters; /** * @param array<string, mixed> $args * @param NextStep[] $nextSteps */ public function __construct( string $id, string $type, string $key, array $args, array $nextSteps, Filters $filters = null ) { $this->id = $id; $this->type = $type; $this->key = $key; $this->args = $args; $this->nextSteps = $nextSteps; $this->filters = $filters; } public function getId(): string { return $this->id; } public function getType(): string { return $this->type; } public function getKey(): string { return $this->key; } /** @return NextStep[] */ public function getNextSteps(): array { return $this->nextSteps; } /** @param NextStep[] $nextSteps */ public function setNextSteps(array $nextSteps): void { $this->nextSteps = $nextSteps; } public function getArgs(): array { return $this->args; } public function getFilters(): ?Filters { return $this->filters; } public function toArray(): array { return [ 'id' => $this->id, 'type' => $this->type, 'key' => $this->key, 'args' => $this->args, 'next_steps' => array_map(function (NextStep $nextStep) { return $nextStep->toArray(); }, $this->nextSteps), 'filters' => $this->filters ? $this->filters->toArray() : null, ]; } public static function fromArray(array $data): self { return new self( $data['id'], $data['type'], $data['key'], $data['args'], array_map(function (array $nextStep) { return NextStep::fromArray($nextStep); }, $data['next_steps']), isset($data['filters']) ? Filters::fromArray($data['filters']) : null ); } }