registry = $registry; $this->subjectTransformerHandler = $subjectTransformerHandler; } public function initialize(Automation $automation): void { } public function visitNode(Automation $automation, AutomationNode $node): void { $step = $node->getStep(); $registryStep = $this->registry->getStep($step->getKey()); if (!$registryStep) { return; } // triggers don't require any subjects (they provide them) if ($step->getType() === Step::TYPE_TRIGGER) { return; } $requiredSubjectKeys = $registryStep->getSubjectKeys(); if (!$requiredSubjectKeys) { return; } $subjectKeys = $this->subjectTransformerHandler->getSubjectKeysForAutomation($automation); $missingSubjectKeys = array_diff($requiredSubjectKeys, $subjectKeys); if (count($missingSubjectKeys) > 0) { throw Exceptions::missingRequiredSubjects($step, $missingSubjectKeys); } } public function complete(Automation $automation): void { } }