The Progress Bar component is a trait that implements three methods:
public function initProgressBar(int $total, int $barSize = 30): voidThis method must be the first one to be called when we want to display a
progress bar. The $total parameter is a reference to the number of units
that we are considering 100% (like 1000 files or 5000 db entries that need to
be processed).
public function addProgress(int $progress, string $message = ''): void;The add progress method includes a $progress amount to the progress bar,
moving X percent of the bar to the goal of $total items defined in the
init method.
This method should be called everytime that we want to do some update in the
progress bar state, being a 1 + 1 + 1 progress, in bulks or some random number
like in bytes for upload.
public function endProgressBar(): void;Once we are done with our progress bar, we should call this last method to conclude progress bar.
Similarly to the Progress Bar, we also have three methods, one for initializing other for updating and one last for finalizing.
public function initInfiniteBar(int $barSize = 30): void;public function loopInfiniteBar(int $totalSteps = 20, int $blockSize = 3): void;Here is the main difference. For the infinite progress bar instead of updating a certain amount, we trigger a loop. We can control the feeling and duration of this loop with the function parameters.
Lower
$totalStepsmeans faster loops but worst animation

