getValidator() public method

public getValidator ( )
Esempio n. 1
0
 protected function askQuestion(InteractiveQuestion $question)
 {
     $dialog = $this->getHelperSet()->get('dialog');
     return $dialog->askAndValidate($this->getOutput(), $question->getFormatedText(), $question->getValidator(), false, $question->getDefault());
 }
Esempio n. 2
0
File: Output.php Progetto: liip/rmt
 public function askQuestion(InteractiveQuestion $question, $position = null, InputInterface $input = null)
 {
     $text = ($position !== null ? $position . ') ' : null) . $question->getFormatedText();
     if ($this->dialogHelper instanceof QuestionHelper) {
         if (!$input) {
             throw new \InvalidArgumentException('With symfony 3, the input stream may not be null');
         }
         $q = new Question($text, $question->getDefault());
         $q->setValidator($question->getValidator());
         if ($question->isHiddenAnswer()) {
             $q->setHidden(true);
         }
         return $this->dialogHelper->ask($input, $this, $q);
     }
     if ($this->dialogHelper instanceof DialogHelper) {
         if ($question->isHiddenAnswer()) {
             return $this->dialogHelper->askHiddenResponseAndValidate($this, $text, $question->getValidator(), false);
         }
         return $this->dialogHelper->askAndValidate($this, $text, $question->getValidator(), false, $question->getDefault());
     }
     throw new \RuntimeException("Invalid dialogHelper");
 }