Gush\ThirdParty\Bitbucket\BitBucketConfigurator::interact PHP Method

interact() public method

public interact ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    public function interact(InputInterface $input, OutputInterface $output)
    {
        $config = [];
        $authenticationLabels = array_map(function ($value) {
            return $value[0];
        }, $this->authenticationOptions);
        $authenticationType = array_search($this->questionHelper->ask($input, $output, new ChoiceQuestion('Choose ' . $this->label . ' authentication type:', $authenticationLabels, $authenticationLabels[0])), $authenticationLabels);
        $config['authentication'] = [];
        $config['authentication']['http-auth-type'] = $this->authenticationOptions[$authenticationType][1];
        $config['authentication']['username'] = $this->questionHelper->ask($input, $output, (new Question('Username: '))->setValidator([$this, 'validateNoneEmpty']));
        if (static::AUTH_HTTP_TOKEN === $config['authentication']['http-auth-type']) {
            $config['authentication']['key'] = $this->questionHelper->ask($input, $output, (new Question('Key: '))->setValidator([$this, 'validateNoneEmpty']));
            $config['authentication']['secret'] = $this->questionHelper->ask($input, $output, (new Question('Secret: '))->setHidden(true)->setValidator([$this, 'validateNoneEmpty']));
        } else {
            $config['authentication']['password'] = $this->questionHelper->ask($input, $output, (new Question('Password: '))->setValidator([$this, 'validateNoneEmpty'])->setHidden(true));
        }
        // Not really configurable at the moment, so hard-configured
        $config['base_url'] = rtrim($this->apiUrl, '/');
        $config['repo_domain_url'] = rtrim($this->repoUrl, '/');
        return $config;
    }
BitBucketConfigurator