Add step run controller to allow actions control their flow

[MAILPOET-5569]
This commit is contained in:
Jan Jakes
2023-08-18 15:32:51 +02:00
committed by Aschepikov
parent 5f088d2c35
commit 9d4f55b399
3 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Control;
use MailPoet\Automation\Engine\Data\StepRunArgs;
class StepRunController {
/** @var StepScheduler */
private $stepScheduler;
/** @var StepRunArgs */
private $stepRunArgs;
public function __construct(
StepScheduler $stepScheduler,
StepRunArgs $stepRunArgs
) {
$this->stepScheduler = $stepScheduler;
$this->stepRunArgs = $stepRunArgs;
}
public function scheduleProgress(int $timestamp = null): int {
return $this->stepScheduler->scheduleProgress($this->stepRunArgs, $timestamp);
}
public function scheduleNextStep(int $timestamp = null): int {
return $this->stepScheduler->scheduleNextStep($this->stepRunArgs, $timestamp);
}
public function hasScheduledNextStep(): bool {
return $this->stepScheduler->hasScheduledNextStep($this->stepRunArgs);
}
}