Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
20 | 1 | public static function echo(string $str, ?string $foreground_color = null): void { |
|
21 | |||
22 | 1 | $lines = preg_split("/\r\n|\n|\r/", $str); |
|
23 | |||
24 | 1 | $output = []; |
|
25 | 1 | foreach ($lines as $line) { |
|
26 | 1 | if ($foreground_color !== null) { |
|
27 | 1 | $line = Color::getColoredString($line, $foreground_color); |
|
28 | } |
||
29 | 1 | $output[] = $line; |
|
30 | } |
||
31 | |||
32 | 1 | echo implode(self::EOL, $output); |
|
33 | 1 | } |
|
36 | } |