Exemple #1
0
 /**
  * Display an error message using red color on the console to make it
  * easier to spot.
  *
  * @param string $error
  * @returns RendererInterface
  */
 public function error($error)
 {
     echo PHP_EOL;
     $this->console->writeLine('ERROR: ' . $error . PHP_EOL, Color::calculate('ff0000'));
     echo PHP_EOL;
     return $this;
 }
Exemple #2
0
 /**
  * @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;
 }