| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public static function plainToHtml(string $plainText, string $prefix = '', string $postfix = ''): string |
||
| 17 | { |
||
| 18 | if (empty($plainText)) { |
||
| 19 | return ''; |
||
| 20 | } |
||
| 21 | |||
| 22 | $paragraphs = explode("\n", $plainText); |
||
| 23 | |||
| 24 | $lines = []; |
||
| 25 | foreach ($paragraphs as $paragraph) { |
||
| 26 | if (empty($paragraph)) { |
||
| 27 | continue; |
||
| 28 | } |
||
| 29 | $lines[] = "$prefix$paragraph$postfix"; |
||
| 30 | } |
||
| 31 | |||
| 32 | return implode("\n", $lines); |
||
| 33 | } |
||
| 35 |