public function ProgressHelper::setCurrent in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Helper/ProgressHelper.php \Symfony\Component\Console\Helper\ProgressHelper::setCurrent()
Sets the current progress.
Parameters
int $current The current progress:
bool $redraw Whether to redraw or not:
Throws
\LogicException
1 call to ProgressHelper::setCurrent()
- ProgressHelper::advance in vendor/
symfony/ console/ Helper/ ProgressHelper.php - Advances the progress output X steps.
File
- vendor/
symfony/ console/ Helper/ ProgressHelper.php, line 254
Class
- ProgressHelper
- The Progress class provides helpers to display progress output.
Namespace
Symfony\Component\Console\HelperCode
public function setCurrent($current, $redraw = false) {
if (null === $this->startTime) {
throw new \LogicException('You must start the progress bar before calling setCurrent().');
}
$current = (int) $current;
if ($current < $this->current) {
throw new \LogicException('You can\'t regress the progress bar');
}
if (0 === $this->current) {
$redraw = true;
}
$prevPeriod = (int) ($this->current / $this->redrawFreq);
$this->current = $current;
$currPeriod = (int) ($this->current / $this->redrawFreq);
if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
$this
->display();
}
}