protected function getSelectedEnvironment() { if (!$this->environment) { throw new \BadMethodCallException('No environment selected'); } return $this->environment; }