Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/ProgressBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
final class ProgressBar
{
/** Character to display current progress in progress bar */
/** Character to display current progress in the progress bar */
private string $barCharacter = '#';

/** Width of progress bar, in number of characters */
Expand All @@ -16,19 +16,19 @@ final class ProgressBar
/** Minimum time in seconds between consecutive refreshes of display */
private float $drawFrequency = 0.25;

/** Character to display remaining progress in progress bar */
/** Character to display remaining progress in the progress bar */
private string $emptyBarCharacter = '.';

/** Estimated time to finish in seconds */
private int $estimatedTime = 0;

/** Timing of last display */
/** Timing of the last display */
private float $lastDisplayTime = 0.0;

/** Current progress in percentage */
private int $percentage = 0;

/** Time when progress bar starts displaying */
/** Time when the progress bar starts displaying */
private int $startTime;

/**
Expand Down Expand Up @@ -56,7 +56,7 @@ public function __construct(
}

/**
* Move cursor to line start and clear whole line.
* Move the cursor to line start and clear the whole line.
*/
private function clearLine(): void
{
Expand Down Expand Up @@ -85,7 +85,7 @@ private function display(): ProgressBar
str_pad(string: $this->getPercentage(), length: 3, pad_type: STR_PAD_LEFT)
);

/** Remove estimated time from display when done */
/** Remove estimated time from the display when done */
if ($this->percentage < 100) {
echo sprintf(
' (%02d:%02d:%02d)',
Expand All @@ -110,7 +110,7 @@ public function finish(): void
}

/**
* Get estimated time for progress bar to complete.
* Get estimated time for the progress bar to complete.
*/
public function getEstimatedTime(): string
{
Expand Down Expand Up @@ -146,7 +146,7 @@ public function getProgress(): int
*/
private function hideCursor(): ProgressBar
{
/** Show cursor again in case of any exit code */
/** Show the cursor again in case of any exit code */
register_shutdown_function(function () {
$this->showCursor();
});
Expand Down Expand Up @@ -183,7 +183,7 @@ public function iterate(\Countable|iterable $iterable): iterable
}

/**
* Change default character for completed progress
* Change the default character for completed progress
*/
public function setBarCharacter(string $character): ProgressBar
{
Expand All @@ -193,7 +193,7 @@ public function setBarCharacter(string $character): ProgressBar
}

/**
* Change default character for incomplete progress.
* Change the default character for incomplete progress.
*/
public function setEmptyBarCharacter(string $character): ProgressBar
{
Expand All @@ -203,7 +203,7 @@ public function setEmptyBarCharacter(string $character): ProgressBar
}

/**
* Calculate estimated time for completion of progress bar.
* Calculate the estimated time for completion of the progress bar.
*/
private function setEstimatedTime(): ProgressBar
{
Expand Down Expand Up @@ -257,7 +257,7 @@ public function setProgress(int|float $progress): ProgressBar
}

/**
* Show cursor again after finishing progress bar
* Show the cursor again after finishing the progress bar
*/
private function showCursor(): ProgressBar
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ProgressBarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function setUp(): void
}

/**
* Flush and return output buffer
* Flush and return the output buffer
*/
public function tearDown(): void
{
Expand Down
Loading