/** * @return bool */ public function prepare() { if ($this->stages->count() === 0) { $this->logger->warning("Job has no stages, cannot continue"); return false; } foreach ($this->stages as $n => $stage) { $this->stageMapping[$stage->getName()] = $n + 1; $stage->setJobHandler($this); $stage->setLogger($this->logger); } $this->logger->debug("Prepared Job with {$this->stages->count()} stages"); return true; }
/** * Adds a stage. * * @param Stage $stage Stage * * @return $this */ public function addStage(Stage $stage) { $this->stages->attach($stage); return $this; }