Example #1
0
 protected function write(array $record)
 {
     $message = $record['message'];
     Display::line($message);
 }
Example #2
0
 /**
  * Pose la question et récupère la réponse
  *
  * @return string
  */
 public function run()
 {
     $ok = false;
     do {
         \Siwayll\Deuton\Display::write($this->message);
         \Siwayll\Deuton\Display::write(DEUTON_MIN_PROMPT);
         $foo = fgets(STDIN);
         if ($this->trim === true) {
             $foo = trim($foo);
         }
         if ($this->acceptEmpty !== true) {
             if (empty($foo)) {
                 continue;
             }
         }
         $ok = true;
         if (is_callable($this->ctrl)) {
             $ok = call_user_func($this->ctrl, $foo);
         }
     } while (!$ok);
     return $foo;
 }
Example #3
0
 /**
  * Ecriture du resultat de l'aspiration dans un fichier
  *
  * @param Command   $cmd     Commande en cours
  * @param string    $content Resultat de l'aspiration
  * @param Mollicute $moll    Plan d'aspiration
  *
  * @return array
  */
 public function after(Command $cmd, $content, Mollicute $moll)
 {
     $color = 'green';
     if (curl_error($this->curl->get()) !== '') {
         $color = 'red';
     }
     $line = "\r{.c:" . $color . '}' . $this->curl->getOpt(CURLOPT_URL) . '                         {.reset}';
     Display::line($line);
 }