33 lines
712 B
PHP
33 lines
712 B
PHP
<?php declare(strict_types = 1);
|
|
|
|
namespace MailPoet\Automation\Engine\Control;
|
|
|
|
use MailPoet\Automation\Engine\Exceptions\InvalidStateException;
|
|
use MailPoet\Automation\Engine\Hooks;
|
|
use MailPoet\Automation\Engine\WordPress;
|
|
|
|
class StepRunner {
|
|
/** @var WordPress */
|
|
private $wordPress;
|
|
|
|
public function __construct(
|
|
WordPress $wordPress
|
|
) {
|
|
$this->wordPress = $wordPress;
|
|
}
|
|
|
|
public function initialize(): void {
|
|
$this->wordPress->addAction(Hooks::WORKFLOW_STEP, [$this, 'run']);
|
|
}
|
|
|
|
/** @param mixed $args */
|
|
public function run($args): void {
|
|
// TODO: args validation
|
|
if (!is_array($args)) {
|
|
throw new InvalidStateException();
|
|
}
|
|
|
|
// TODO: process step
|
|
}
|
|
}
|