| Conditions | 6 |
| Paths | 10 |
| Total Lines | 26 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | public static function splitCommands(string $input): array |
||
| 8 | { |
||
| 9 | $lines = explode("\n", $input); |
||
| 10 | $commands = []; |
||
| 11 | $current = ''; |
||
| 12 | |||
| 13 | foreach ($lines as $line) { |
||
| 14 | if (trim($line) === '') { |
||
| 15 | continue; |
||
| 16 | } |
||
| 17 | |||
| 18 | if (preg_match('/^\s+/', $line)) { |
||
| 19 | $current .= "\n" . $line; |
||
| 20 | } else { |
||
| 21 | if ($current !== '') { |
||
| 22 | $commands[] = trim($current); |
||
| 23 | } |
||
| 24 | $current = $line; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | if ($current !== '') { |
||
| 29 | $commands[] = trim($current); |
||
| 30 | } |
||
| 31 | |||
| 32 | return $commands; |
||
| 33 | } |
||
| 35 | } |