コード例 #1
0
ファイル: LineTest.php プロジェクト: pnaq57/zf2demo
 public function testCanReadLineWithEmptyAnswer()
 {
     $line = new Line('Where is Bryan ?', true);
     $line->setConsole($this->adapter);
     ob_start();
     $response = $line->show();
     $text = ob_get_clean();
     $this->assertEquals($text, "Where is Bryan ?");
     $this->assertEquals('', $response);
 }
コード例 #2
0
ファイル: Help.php プロジェクト: ocramius/ocramius
 /**
  * @param $question
  * @param ConsoleAdapter $console
  *
  * @return string|null
  */
 private function askUrlQuestion($question, ConsoleAdapter $console)
 {
     $console->writeLine($question . ' (URL)', ColorInterface::CYAN);
     $prompt = new Line('');
     $prompt->setConsole($console);
     $url = $prompt->show();
     if (!(new Uri(['allowRelative' => false]))->isValid($url)) {
         $console->writeLine('The provided URL "' . $url . '" doesn\'t seem to be valid!', ColorInterface::RED);
         return null;
     }
     return $url;
 }
コード例 #3
0
ファイル: Markdown.php プロジェクト: bravadomizzou/dewdrop
 public function ask($promptText, $allowEmpty = false)
 {
     $prompt = new LinePrompt($promptText, $allowEmpty);
     $prompt->setConsole($this->console);
     return $prompt->show();
 }