private function showEnvironmentRolesForm(array $defaultEnvironmentRoles, InputInterface $input)
    {
        /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
        $questionHelper = $this->getService('question_helper');
        $desiredEnvironmentRoles = [];
        $validEnvironmentRoles = array_merge(EnvironmentAccess::$roles, ['none']);
        $this->stdErr->writeln("The user's environment role(s) can be " . $this->describeRoles($validEnvironmentRoles) . '.');
        $initials = $this->describeRoleInput($validEnvironmentRoles);
        $this->stdErr->writeln('');
        foreach (array_keys($this->api()->getEnvironments($this->getSelectedProject())) as $id) {
            $default = isset($defaultEnvironmentRoles[$id]) ? $defaultEnvironmentRoles[$id] : 'none';
            $question = new Question(
                sprintf('Role on <info>%s</info> (default: %s) <question>%s</question>: ', $id, $default, $initials),
                $default
            );
            $question->setValidator(function ($answer) {
                if ($answer === 'q' || $answer === 'quit') {
                    return $answer;
                }

                return $this->validateEnvironmentRole($answer);
            });
            $question->setAutocompleterValues(array_merge($validEnvironmentRoles, ['quit']));
            $question->setMaxAttempts(5);
            $answer = $questionHelper->ask($input, $this->stdErr, $question);
            if ($answer === 'q' || $answer === 'quit') {
                break;
            } else {
                $desiredEnvironmentRoles[$id] = $answer;
            }
        }

        return $desiredEnvironmentRoles;
    }
private function showEnvironmentRolesForm(array $defaultEnvironmentRoles, InputInterface $input)
    {
        /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
        $questionHelper = $this->getService('question_helper');
        $desiredEnvironmentRoles = [];
        $validEnvironmentRoles = array_merge(EnvironmentAccess::$roles, ['none']);
        $this->stdErr->writeln("The user's environment role(s) can be " . $this->describeRoles($validEnvironmentRoles) . '.');
        $initials = $this->describeRoleInput($validEnvironmentRoles);
        $this->stdErr->writeln('');
        foreach (array_keys($this->api()->getEnvironments($this->getSelectedProject())) as $id) {
            $default = isset($defaultEnvironmentRoles[$id]) ? $defaultEnvironmentRoles[$id] : 'none';
            $question = new Question(
                sprintf('Role on <info>%s</info> (default: %s) <question>%s</question>: ', $id, $default, $initials),
                $default
            );
            $question->setValidator(function ($answer) {
                if ($answer === 'q' || $answer === 'quit') {
                    return $answer;
                }

                return $this->validateEnvironmentRole($answer);
            });
            $question->setAutocompleterValues(array_merge($validEnvironmentRoles, ['quit']));
            $question->setMaxAttempts(5);
            $answer = $questionHelper->ask($input, $this->stdErr, $question);
            if ($answer === 'q' || $answer === 'quit') {
                break;
            } else {
                $desiredEnvironmentRoles[$id] = $answer;
            }
        }

        return $desiredEnvironmentRoles;
    }
private function showEnvironmentRolesForm ( array $ defaultEnvironmentRoles , InputInterface $ input ) { /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ $ questionHelper = $ this -> getService ( 'question_helper' ) ; $ desiredEnvironmentRoles = [ ] ; $ validEnvironmentRoles = array_merge ( EnvironmentAccess :: $ roles , [ 'none' ] ) ; $ this -> stdErr -> writeln ( "The user's environment role(s) can be " . $ this -> describeRoles ( $ validEnvironmentRoles ) . '.' ) ; $ initials = $ this -> describeRoleInput ( $ validEnvironmentRoles ) ; $ this -> stdErr -> writeln ( '' ) ; foreach ( array_keys ( $ this -> api ( ) -> getEnvironments ( $ this -> getSelectedProject ( ) ) ) as $ id ) { $ default = isset ( $ defaultEnvironmentRoles [ $ id ] ) ? $ defaultEnvironmentRoles [ $ id ] : 'none' ; $ question = new Question ( sprintf ( 'Role on <info>%s</info> (default: %s) <question>%s</question>: ' , $ id , $ default , $ initials ) , $ default ) ; $ question -> setValidator ( function ( $ answer ) { if ( $ answer === 'q' || $ answer === 'quit' ) { return $ answer ; } return $ this -> validateEnvironmentRole ( $ answer ) ; } ) ; $ question -> setAutocompleterValues ( array_merge ( $ validEnvironmentRoles , [ 'quit' ] ) ) ; $ question -> setMaxAttempts ( 5 ) ; $ answer = $ questionHelper -> ask ( $ input , $ this -> stdErr , $ question ) ; if ( $ answer === 'q' || $ answer === 'quit' ) { break ; } else { $ desiredEnvironmentRoles [ $ id ] = $ answer ; } } return $ desiredEnvironmentRoles ; }
Show the form for entering environment roles.

@param array                                           $defaultEnvironmentRoles
@param \Symfony\Component\Console\Input\InputInterface $input

@return array
The environment roles (keyed by environment ID) including the user's
answers.
Show the form for entering environment roles .