public function askHiddenResponseAndValidate($question, $validator, $attempts = false, $fallback = true)
    {
        $question = (new Question($question))
            ->setValidator($validator)
            ->setMaxAttempts($attempts)
            ->setHidden(true)
            ->setHiddenFallback($fallback);

        return $this->getQuestionHelper()->ask($this->getInput(), $this->output, $question);
    }
public function askHiddenResponseAndValidate($question, $validator, $attempts = false, $fallback = true)
    {
        $question = (new Question($question))
            ->setValidator($validator)
            ->setMaxAttempts($attempts)
            ->setHidden(true)
            ->setHiddenFallback($fallback);

        return $this->getQuestionHelper()->ask($this->getInput(), $this->output, $question);
    }
public function askHiddenResponseAndValidate ( $ question , $ validator , $ attempts = false , $ fallback = true ) { $ question = ( new Question ( $ question ) ) -> setValidator ( $ validator ) -> setMaxAttempts ( $ attempts ) -> setHidden ( true ) -> setHiddenFallback ( $ fallback ) ; return $ this -> getQuestionHelper ( ) -> ask ( $ this -> getInput ( ) , $ this -> output , $ question ) ; }
Asks for a value, hide and validates the response

The validator receives the data to validate. It must return the
validated data when the data is valid and throw an exception
otherwise.

@param string|array $question The question to ask. If an array each array item is turned into one line of a multi-line question
@param callable $validator A PHP callback that gets a value and is expected to return the (transformed) value or throw an exception if it wasn't valid
@param int|bool $attempts Max number of times to ask before giving up (false by default, which means infinite)
@param bool $fallback In case the response can not be hidden, whether to fallback on non-hidden question or not
@throws \Symfony\Component\Console\Exception\InvalidArgumentException
@throws \Symfony\Component\Console\Exception\LogicException
@throws \Symfony\Component\Console\Exception\RuntimeException
@return string The response
Asks for a value hide and validates the response