Platformsh\Cli\Command\CommandBase::selectEnvironment PHP Метод

selectEnvironment() защищенный Метод

Select the current environment for the user.
protected selectEnvironment ( string | null $environmentId = null ) : Platformsh\Client\Model\Environment
$environmentId string | null The environment ID specified by the user, or null to auto-detect the environment.
Результат Platformsh\Client\Model\Environment
    protected function selectEnvironment($environmentId = null)
    {
        if (!empty($environmentId)) {
            $environment = $this->api()->getEnvironment($environmentId, $this->project, null, true);
            if (!$environment) {
                throw new \RuntimeException('Specified environment not found: ' . $environmentId);
            }
            return $environment;
        }
        // If no ID is specified, try to auto-detect the current environment.
        if ($environment = $this->getCurrentEnvironment($this->project)) {
            return $environment;
        }
        if ($this->getProjectRoot()) {
            $message = 'Could not determine the current environment.' . "\n" . 'Specify it manually using --environment (-e).';
        } else {
            $message = 'No environment specified.' . "\n" . 'Specify one using --environment (-e), or go to a project directory.';
        }
        throw new \RuntimeException($message);
    }