Conditions | 3 |
Paths | 3 |
Total Lines | 29 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function getParsed(): array |
||
16 | { |
||
17 | $contents = file_get_contents($this->path); |
||
18 | |||
19 | $lines = explode(PHP_EOL, $contents); |
||
20 | |||
21 | $outline = []; |
||
22 | |||
23 | foreach ($lines as $line) { |
||
24 | if (!strlen($line)) { |
||
25 | $outline[] = null; |
||
26 | |||
27 | continue; |
||
28 | } |
||
29 | |||
30 | $totalLineCount = strlen($line); |
||
31 | |||
32 | $characterLineCount = strlen(ltrim($line)); |
||
33 | |||
34 | $indentLineCount = $totalLineCount - $characterLineCount; |
||
35 | |||
36 | $indentLine = array_fill(0, $indentLineCount, -1); |
||
37 | |||
38 | $characterLine = array_fill(0, $characterLineCount, 1); |
||
39 | |||
40 | $outline[] = array_merge($indentLine, $characterLine); |
||
41 | } |
||
42 | |||
43 | return $outline; |
||
44 | } |
||
46 |