Exemple #1
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;
 }
Exemple #2
0
 /**
  * Affichage du compteur de temporisation
  *
  * @param int $count Compteur
  */
 public function tickSleep($count)
 {
     $line = "\r";
     $line .= str_pad($this->countPlan, 6);
     $line .= str_pad($count, '6', ' ', STR_PAD_BOTH);
     Display::write($line);
 }