Пример #1
0
function test_notify(\cli\Notify $notify, $cycle = 1000000, $sleep = null)
{
    for ($i = 0; $i <= $cycle; $i++) {
        $notify->tick();
        if ($sleep) {
            usleep($sleep);
        }
    }
    $notify->finish();
}
Пример #2
0
 /**
  * Instatiates a Notification object.
  *
  * @param string  $msg       The text to display next to the Notifier.
  * @param int     $dots      The number of dots to iterate through.
  * @param int     $interval  The interval in milliseconds between updates.
  * @throws \InvalidArgumentException
  */
 public function __construct($msg, $dots = 3, $interval = 100)
 {
     parent::__construct($msg, $interval);
     $this->_dots = (int) $dots;
     if ($this->_dots <= 0) {
         throw new \InvalidArgumentException('Dot count out of range, must be positive.');
     }
 }
Пример #3
0
 /**
  * Forces the current tick count to the total ticks given at instatiation
  * time before passing on to `cli\Notify::finish()`.
  */
 public function finish()
 {
     $this->_current = $this->_total;
     parent::finish();
 }