Skip to content

Commit f543dbc

Browse files
Merge pull request #110
Refactor `LineView`
2 parents 96cab21 + f702820 commit f543dbc

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/View/LineView.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
namespace DragonCode\Benchmark\View;
66

7+
use function array_fill;
8+
use function implode;
9+
use function max;
10+
711
class LineView extends View
812
{
913
/**
@@ -23,8 +27,8 @@ public function line(string $text): void
2327
*/
2428
public function newLine(int $count = 1): void
2529
{
26-
for ($i = 0; $i < $count; $i++) {
27-
$this->writeLine('');
28-
}
30+
$lines = implode('', array_fill(0, max(1, $count), PHP_EOL));
31+
32+
$this->writeLine($lines);
2933
}
3034
}

0 commit comments

Comments
 (0)