/** * Prints the current spinner position to `STDOUT` with the time elapsed * and tick speed. * * @param boolean $finish `true` if this was called from * `cli\Notify::finish()`, `false` otherwise. * @see cli\out_padded() * @see cli\Notify::formatTime() * @see cli\Notify::speed() */ public function display($finish = false) { $msg = $this->_message; $idx = $this->_iteration++ % strlen($this->_chars); $char = $this->_chars[$idx]; $speed = number_format(round($this->speed())); $elapsed = $this->formatTime($this->elapsed()); Streams::out_padded($this->_format, compact('msg', 'char', 'elapsed', 'speed')); }
/** * Prints the correct number of dots to `STDOUT` with the time elapsed and * tick speed. * * @param boolean $finish `true` if this was called from * `cli\Notify::finish()`, `false` otherwise. * @see cli\out_padded() * @see cli\Notify::formatTime() * @see cli\Notify::speed() */ public function display($finish = false) { $repeat = $this->_dots; if (!$finish) { $repeat = $this->_iteration++ % $repeat; } $msg = $this->_message; $dots = str_pad(str_repeat('.', $repeat), $this->_dots); $speed = number_format(round($this->speed())); $elapsed = $this->formatTime($this->elapsed()); Streams::out_padded($this->_format, compact('msg', 'dots', 'speed', 'elapsed')); }