Command/ConfigCommand.php
public function execute(InputInterface $input, OutputInterface $output)
    {
        $config = null;
        $connection = null;

        $this->input = $input;
        $this->output = $output;
        $this->helper = $this->getHelper('question');
        $this->silent = $input->getOption('silent');
        $this->interactive = !$input->getOption('non-interactive');
        $this->serverPool = $this->serverPool ?: new LdapServerPool(new DomainConfiguration(''));

        $domain = trim($input->getOption('domain'));
        $server = $input->getOption('server');
        $port = (int) $input->getOption('port');
        $username = trim($input->getOption('username'));
        $password = $input->getOption('password');
        $useTls = $input->getOption('use-tls');
        $useSsl = $input->getOption('use-ssl');
        $this->validateOptions($server, $domain, $username, $password, $useTls, $useSsl);

        while (!$connection) {
            $config = $this->getConfigForDomain($server, $domain, $port, $useTls, $useSsl);
            if (!$config && (!$this->interactive || !$this->confirm('<question>Try again? [Y/n]: </question>'))) {
                return 1;
            } elseif (!$config) {
                continue;
            }
            $connection = $this->getLdapConnection($config);
            if (!$connection && (!$this->interactive || !$this->confirm('<question>Try again? [Y/n]: </question>'))) {
                return 1;
            }
        }
        if (!$useTls && !$useSsl && $this->interactive) {
            while (!$this->chooseEncryption($connection)) {
                if ($this->confirm('<question>Continue without encryption? [Y/n]: </question>')) {
                    break;
                }
            }
        }

        while (!$this->verifyCredentials($connection, $username, $password)) {
            if (!$this->confirm('<question>Try a different username/password? [Y/n]: </question>')) {
                return 1;
            }
            $username = null;
            $password = null;
        }

        $this->askAndShowConfig($config, $input, $output);

        return 0;
    }
public function execute(InputInterface $input, OutputInterface $output)
    {
        $config = null;
        $connection = null;

        $this->input = $input;
        $this->output = $output;
        $this->helper = $this->getHelper('question');
        $this->silent = $input->getOption('silent');
        $this->interactive = !$input->getOption('non-interactive');
        $this->serverPool = $this->serverPool ?: new LdapServerPool(new DomainConfiguration(''));

        $domain = trim($input->getOption('domain'));
        $server = $input->getOption('server');
        $port = (int) $input->getOption('port');
        $username = trim($input->getOption('username'));
        $password = $input->getOption('password');
        $useTls = $input->getOption('use-tls');
        $useSsl = $input->getOption('use-ssl');
        $this->validateOptions($server, $domain, $username, $password, $useTls, $useSsl);

        while (!$connection) {
            $config = $this->getConfigForDomain($server, $domain, $port, $useTls, $useSsl);
            if (!$config && (!$this->interactive || !$this->confirm('<question>Try again? [Y/n]: </question>'))) {
                return 1;
            } elseif (!$config) {
                continue;
            }
            $connection = $this->getLdapConnection($config);
            if (!$connection && (!$this->interactive || !$this->confirm('<question>Try again? [Y/n]: </question>'))) {
                return 1;
            }
        }
        if (!$useTls && !$useSsl && $this->interactive) {
            while (!$this->chooseEncryption($connection)) {
                if ($this->confirm('<question>Continue without encryption? [Y/n]: </question>')) {
                    break;
                }
            }
        }

        while (!$this->verifyCredentials($connection, $username, $password)) {
            if (!$this->confirm('<question>Try a different username/password? [Y/n]: </question>')) {
                return 1;
            }
            $username = null;
            $password = null;
        }

        $this->askAndShowConfig($config, $input, $output);

        return 0;
    }
{@inheritdoc}