Conditions | 3 |
Paths | 3 |
Total Lines | 25 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function getParsed(): Page |
||
20 | { |
||
21 | $contents = file_get_contents($this->path); |
||
22 | |||
23 | $lines = explode(PHP_EOL, $contents); |
||
24 | |||
25 | $page = new Page(); |
||
26 | |||
27 | foreach ($lines as $line) { |
||
28 | if (!strlen($line)) { |
||
29 | $page[] = new EmptyLine(); |
||
30 | |||
31 | continue; |
||
32 | } |
||
33 | |||
34 | $totalLineCount = strlen($line); |
||
35 | |||
36 | $characterCount = strlen(ltrim($line)); |
||
37 | |||
38 | $indentationCount = $totalLineCount - $characterCount; |
||
39 | |||
40 | $page[] = Line::make($indentationCount, $characterCount); |
||
41 | } |
||
42 | |||
43 | return $page; |
||
44 | } |
||
46 |