/**
  * Increments the progressbar.
  *
  * @param integer $increment Increment
  * @return \ApiGen\ConsoleProgressBar
  */
 public function increment($increment = 1)
 {
     static $width = 80;
     static $barWidth = 64;
     echo str_repeat(chr(0x8), $width);
     $this->current = min($this->maximum, $this->current + (int) $increment);
     $percent = $this->current / $this->maximum;
     $progress = str_pad(str_pad('>', round($percent * $barWidth), '=', STR_PAD_LEFT), $barWidth, ' ', STR_PAD_RIGHT);
     $this->logger->log(sprintf('[%s] %\' 6.2f%% %\' 3dMB', $progress, $percent * 100, round(memory_get_usage(true) / 1024 / 1024)));
     if ($this->current === $this->maximum) {
         $this->logger->log("\n");
     }
     return $this;
 }
 /**
  * Increments the progressbar.
  *
  * @param integer $increment Increment
  * @return \ApiGen\Contrib\PhpunitProgressBar
  */
 public function increment($increment = 1)
 {
     if ($this->current >= $this->maximum) {
         // No progressbar beyond 100 %
         return;
     }
     $currentSteps = floor($this->current * $this->stepSize);
     $this->current += $increment;
     $newSteps = floor($this->current * $this->stepSize);
     if ($newSteps === $currentSteps) {
         // No progress
         return $this;
     }
     $maxSteps = round($this->maximum * $this->stepSize);
     // Max steps per line
     $perLine = $this->maxWidth - 10;
     while ($currentSteps++ < $newSteps) {
         $this->logger->log('.');
         // End of line or 100 % reached
         if ($this->maximum === $this->current || 0 === $currentSteps % $perLine) {
             if ($this->maximum === $this->current) {
                 $this->logger->log(str_repeat(' ', 1 + $perLine - $currentSteps % $perLine));
             } else {
                 $this->logger->log(' ');
             }
             $this->logger->log(sprintf("[%3d %%]\n", 100 * $currentSteps / $maxSteps));
         }
     }
     return $this;
 }