public function setStage($stage) { if ($stage === $this->stage) { return; } $this->stage = $stage; $this->handle = null; // If we do have a stage, cleanup previous events if ($stage) { $this->tasks->registerConfiguredEvents(); } }