示例#1
0
 /**
  * @return array
  */
 public function show()
 {
     $inputs = array();
     $more = 'n';
     $msgsGiven = count($this->messages) > 0;
     $isRequired = false;
     if (method_exists($this->prompt, 'getAllowEmpty')) {
         $isRequired = !$this->prompt->getAllowEmpty();
     }
     do {
         if (!$this->skipFirst) {
             if ($msgsGiven) {
                 $msg = array_shift($this->messages);
             } elseif (method_exists($this->prompt, 'getPromptText') && method_exists($this->prompt, 'setPromptText')) {
                 $msg = $this->prompt->getPromptText();
                 $this->prompt->setPromptText($msg);
             }
             do {
                 $input = $this->prompt->show();
                 $inputs[] = $input;
             } while ($isRequired && empty($input));
         }
         $this->skipFirst = false;
         if (!$msgsGiven) {
             $more = Char::prompt($this->moreMessage, 'yn', true, false, false);
         }
     } while ($more == 'y' || $msgsGiven && !empty($this->messages));
     return $this->lastResponse = $inputs;
 }
示例#2
0
 /**
  * @return mix
  */
 public function show()
 {
     $data = $this->prompt->show();
     if (is_array($data)) {
         $data = array_filter($data, $this->filter);
     }
     return $data;
 }
示例#3
0
 /**
  * @return mix
  */
 public function show()
 {
     $data = $this->prompt->show();
     return call_user_func($this->callback, $data);
 }