-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLineView.php
More file actions
39 lines (33 loc) · 772 Bytes
/
LineView.php
File metadata and controls
39 lines (33 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
namespace DragonCode\Benchmark\View;
use function array_fill;
use function implode;
use function max;
class LineView extends View
{
/**
* Outputs a line of text.
*
* @param string $text The text to output.
*/
public function line(string $text): void
{
$this->writeLine($text);
}
/**
* Outputs the specified number of empty lines.
*
* @param int $count The number of empty lines.
*/
public function newLine(int $count = 1): void
{
$this->writeLine(
$this->buildLine(max(1, $count))
);
}
protected function buildLine(int $count): string
{
return implode('', array_fill(0, max(1, $count), PHP_EOL));
}
}