api = $api; $this->coreIntegration = $coreIntegration; $this->registry = $registry; $this->stepRunner = $stepRunner; $this->triggerHandler = $triggerHandler; $this->wordPress = $wordPress; $this->workflowStorage = $workflowStorage; } public function initialize(): void { // register Action Scheduler (when behind feature flag, do it only on initialization) require_once __DIR__ . '/../../../vendor/woocommerce/action-scheduler/action-scheduler.php'; $this->api->initialize(); $this->stepRunner->initialize(); $this->triggerHandler->initialize(); $this->coreIntegration->register($this->registry); $this->wordPress->doAction(Hooks::INITIALIZE, [$this->registry]); $this->registerActiveTriggerHooks(); } private function registerActiveTriggerHooks(): void { $triggerKeys = $this->workflowStorage->getActiveTriggerKeys(); foreach ($triggerKeys as $triggerKey) { $instance = $this->registry->getTrigger($triggerKey); if ($instance) { $instance->registerHooks(); } } } }