Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
60 | 6 | public static function echo(string $str, ?string $foreground_color = null): void { |
|
61 | |||
62 | 6 | $lines = preg_split("/\r\n|\n|\r/", $str); |
|
63 | |||
64 | 6 | $output = []; |
|
65 | 6 | foreach ($lines as $line) { |
|
66 | 6 | if ($foreground_color !== null) { |
|
67 | 6 | $line = Color::getColoredString($line, $foreground_color); |
|
68 | } |
||
69 | 6 | $output[] = $line; |
|
70 | } |
||
71 | |||
72 | 6 | echo implode(self::EOL, $output); |
|
73 | 6 | } |
|
75 | } |