Rename step runner to handler (free the name to step runner interface)
[MAILPOET-4515]
This commit is contained in:
@@ -15,7 +15,7 @@ use MailPoet\Automation\Engine\Workflows\StepRunner as StepRunnerInterface;
|
||||
use MailPoet\Automation\Engine\Workflows\WorkflowRun;
|
||||
use Throwable;
|
||||
|
||||
class StepRunner {
|
||||
class StepHandler {
|
||||
/** @var ActionScheduler */
|
||||
private $actionScheduler;
|
||||
|
||||
@@ -49,7 +49,7 @@ class StepRunner {
|
||||
}
|
||||
|
||||
public function initialize(): void {
|
||||
$this->wordPress->addAction(Hooks::WORKFLOW_STEP, [$this, 'run']);
|
||||
$this->wordPress->addAction(Hooks::WORKFLOW_STEP, [$this, 'handle']);
|
||||
$this->addStepRunner(Step::TYPE_ACTION, $this->actionStepRunner);
|
||||
$this->wordPress->doAction(Hooks::STEP_RUNNER_INITIALIZE, [$this]);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class StepRunner {
|
||||
}
|
||||
|
||||
/** @param mixed $args */
|
||||
public function run($args): void {
|
||||
public function handle($args): void {
|
||||
// TODO: args validation
|
||||
if (!is_array($args)) {
|
||||
throw new InvalidStateException();
|
||||
@@ -68,7 +68,7 @@ class StepRunner {
|
||||
// Action Scheduler catches only Exception instances, not other errors.
|
||||
// We need to convert them to exceptions to be processed and logged.
|
||||
try {
|
||||
$this->runStep($args);
|
||||
$this->handleStep($args);
|
||||
} catch (Throwable $e) {
|
||||
$this->workflowRunStorage->updateStatus((int)$args['workflow_run_id'], WorkflowRun::STATUS_FAILED);
|
||||
if (!$e instanceof Exception) {
|
||||
@@ -78,7 +78,7 @@ class StepRunner {
|
||||
}
|
||||
}
|
||||
|
||||
private function runStep(array $args): void {
|
||||
private function handleStep(array $args): void {
|
||||
$workflowRunId = $args['workflow_run_id'];
|
||||
$stepId = $args['step_id'];
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace MailPoet\Automation\Engine;
|
||||
|
||||
use MailPoet\Automation\Engine\API\API;
|
||||
use MailPoet\Automation\Engine\Control\StepRunner;
|
||||
use MailPoet\Automation\Engine\Control\StepHandler;
|
||||
use MailPoet\Automation\Engine\Control\TriggerHandler;
|
||||
use MailPoet\Automation\Engine\Endpoints\System\DatabaseDeleteEndpoint;
|
||||
use MailPoet\Automation\Engine\Endpoints\System\DatabasePostEndpoint;
|
||||
@@ -25,8 +25,8 @@ class Engine {
|
||||
/** @var Registry */
|
||||
private $registry;
|
||||
|
||||
/** @var StepRunner */
|
||||
private $stepRunner;
|
||||
/** @var StepHandler */
|
||||
private $stepHandler;
|
||||
|
||||
/** @var TriggerHandler */
|
||||
private $triggerHandler;
|
||||
@@ -41,7 +41,7 @@ class Engine {
|
||||
API $api,
|
||||
CoreIntegration $coreIntegration,
|
||||
Registry $registry,
|
||||
StepRunner $stepRunner,
|
||||
StepHandler $stepHandler,
|
||||
TriggerHandler $triggerHandler,
|
||||
WordPress $wordPress,
|
||||
WorkflowStorage $workflowStorage
|
||||
@@ -49,7 +49,7 @@ class Engine {
|
||||
$this->api = $api;
|
||||
$this->coreIntegration = $coreIntegration;
|
||||
$this->registry = $registry;
|
||||
$this->stepRunner = $stepRunner;
|
||||
$this->stepHandler = $stepHandler;
|
||||
$this->triggerHandler = $triggerHandler;
|
||||
$this->wordPress = $wordPress;
|
||||
$this->workflowStorage = $workflowStorage;
|
||||
@@ -59,7 +59,7 @@ class Engine {
|
||||
$this->registerApiRoutes();
|
||||
|
||||
$this->api->initialize();
|
||||
$this->stepRunner->initialize();
|
||||
$this->stepHandler->initialize();
|
||||
$this->triggerHandler->initialize();
|
||||
|
||||
$this->coreIntegration->register($this->registry);
|
||||
|
@@ -114,7 +114,7 @@ class ContainerConfigurator implements IContainerConfigurator {
|
||||
$container->autowire(\MailPoet\Automation\Engine\Builder\UpdateStepsController::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Automation\Engine\Builder\UpdateWorkflowController::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Automation\Engine\Control\ActionScheduler::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Automation\Engine\Control\StepRunner::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Automation\Engine\Control\StepHandler::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Automation\Engine\Control\SubjectLoader::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Automation\Engine\Control\Steps\ActionStepRunner::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Automation\Engine\Control\TriggerHandler::class)->setPublic(true);
|
||||
|
Reference in New Issue
Block a user