public function askThenRemove(InputInterface $input, OverwritableOutputInterface $output, Question $question)
    {
        // Following suit of ask().
        if (!$input->isInteractive()) {
            return $question->getDefault();
        }

        $this->remove = true;
        $this->question = $question;
        $this->output = $output;
        $this->autocomplete = $this->question->getAutocompleterValues() !== null && $this->hasSttyAvailable();

        $this->output->capture();

        // Wrap normalizer to remove latest question & answer since
        // it is called for each iteration if answer is not valid.
        $normalizer = $question->getNormalizer();
        $question->setNormalizer(function ($value) use ($normalizer) {
            $this->output->remove();
            $this->output->capture();

            if (is_callable($normalizer)) {
                return $normalizer($value);
            }

            return $value;
        });

        try {
            $value = $this->ask($input, $this->output, $question);
        } finally {
            $this->remove = false;
            $this->question = null;
            $this->output->remove();
            $this->output = null;
        }

        return $value;
    }
public function askThenRemove(InputInterface $input, OverwritableOutputInterface $output, Question $question)
    {
        // Following suit of ask().
        if (!$input->isInteractive()) {
            return $question->getDefault();
        }

        $this->remove = true;
        $this->question = $question;
        $this->output = $output;
        $this->autocomplete = $this->question->getAutocompleterValues() !== null && $this->hasSttyAvailable();

        $this->output->capture();

        // Wrap normalizer to remove latest question & answer since
        // it is called for each iteration if answer is not valid.
        $normalizer = $question->getNormalizer();
        $question->setNormalizer(function ($value) use ($normalizer) {
            $this->output->remove();
            $this->output->capture();

            if (is_callable($normalizer)) {
                return $normalizer($value);
            }

            return $value;
        });

        try {
            $value = $this->ask($input, $this->output, $question);
        } finally {
            $this->remove = false;
            $this->question = null;
            $this->output->remove();
            $this->output = null;
        }

        return $value;
    }
public function askThenRemove ( InputInterface $ input , OverwritableOutputInterface $ output , Question $ question ) { // Following suit of ask(). if ( ! $ input -> isInteractive ( ) ) { return $ question -> getDefault ( ) ; } $ this -> remove = true ; $ this -> question = $ question ; $ this -> output = $ output ; $ this -> autocomplete = $ this -> question -> getAutocompleterValues ( ) !== null && $ this -> hasSttyAvailable ( ) ; $ this -> output -> capture ( ) ; // Wrap normalizer to remove latest question & answer since // it is called for each iteration if answer is not valid. $ normalizer = $ question -> getNormalizer ( ) ; $ question -> setNormalizer ( function ( $ value ) use ( $ normalizer ) { $ this -> output -> remove ( ) ; $ this -> output -> capture ( ) ; if ( is_callable ( $ normalizer ) ) { return $ normalizer ( $ value ) ; } return $ value ; } ) ; try { $ value = $ this -> ask ( $ input , $ this -> output , $ question ) ; } finally { $ this -> remove = false ; $ this -> question = null ; $ this -> output -> remove ( ) ; $ this -> output = null ; } return $ value ; }
Ask a question to the user and then remove the question & answer.

@param InputInterface              $input
@param OverwritableOutputInterface $output
@param Question                    $question

@return mixed|string The user answer
Ask a question to the user and then remove the question & answer .