isInteractive() public method

检查输入是否是交互的
public isInteractive ( ) : boolean
return boolean
Esempio n. 1
0
 public function run()
 {
     if (!$this->input->isInteractive()) {
         return $this->question->getDefault();
     }
     if (!$this->question->getValidator()) {
         return $this->doAsk();
     }
     $that = $this;
     $interviewer = function () use($that) {
         return $that->doAsk();
     };
     return $this->validateAttempts($interviewer);
 }
Esempio n. 2
0
 /**
  * 向用户提问
  * @param Input          $input
  * @param Output         $output
  * @param OutputQuestion $question
  * @return string
  */
 public function ask(Input $input, Output $output, OutputQuestion $question)
 {
     if (!$input->isInteractive()) {
         return $question->getDefault();
     }
     if (!$question->getValidator()) {
         return $this->doAsk($output, $question);
     }
     $interviewer = function () use($output, $question) {
         return $this->doAsk($output, $question);
     };
     return $this->validateAttempts($interviewer, $output, $question);
 }
Esempio n. 3
0
 protected function askQuestion(Input $input, Question $question)
 {
     $ask = new Ask($input, $this, $question);
     $answer = $ask->run();
     if ($input->isInteractive()) {
         $this->newLine();
     }
     return $answer;
 }