Skip to content

Commit c885c34

Browse files
Refactor ProgressBarView
1 parent 62c98d8 commit c885c34

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/View/ProgressBarView.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ protected function display(): void
7777
protected function buildLine(int $filled, int $empty, float $percent): string
7878
{
7979
return vsprintf(' %s/%s [%s] %s%%', [
80-
$this->current,
81-
$this->total,
80+
$this->numberFormat($this->current),
81+
$this->numberFormat($this->total),
8282
$this->buildBar($filled, $empty),
8383
$this->percentText($percent),
8484
]);
8585
}
8686

8787
protected function buildBar(int $filled, int $empty): string
8888
{
89-
return str_repeat('', $filled) . str_repeat('', $empty);
89+
return str_repeat('', $filled) . str_repeat('', $empty);
9090
}
9191

9292
protected function percent(): float
@@ -108,4 +108,9 @@ protected function percentText(float $percent): int
108108
{
109109
return (int) floor($percent * 100);
110110
}
111+
112+
protected function numberFormat(int $number): string
113+
{
114+
return number_format($number, thousands_separator: "'");
115+
}
111116
}

0 commit comments

Comments
 (0)