| Total Complexity | 7 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class LineWriter |
||
| 8 | { |
||
| 9 | private array $lines = []; |
||
| 10 | private int $indent = 0; |
||
| 11 | |||
| 12 | public function __construct( |
||
| 15 | |||
| 16 | public function line(string $content = ''): void |
||
| 17 | { |
||
| 18 | $indentation = str_repeat(' ', $this->indent * $this->indentSize); |
||
| 19 | $this->lines[] = $indentation.$content; |
||
| 20 | } |
||
| 21 | |||
| 22 | public function indent(): void |
||
| 23 | { |
||
| 24 | ++$this->indent; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function dedent(): void |
||
| 28 | { |
||
| 29 | if ($this->indent > 0) { |
||
| 30 | --$this->indent; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | public function getContent(): string |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getLines(): array |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 |