public function getStage($index) { if (!isset($this->stages[$index])) { throw new \OutOfRangeException("Could not find stage with index {$index}."); } return $this->stages[$index]; }