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