| @@ 285-298 (lines=14) @@ | ||
| 282 | * |
|
| 283 | * @param string|array $text the text to output, or array of lines |
|
| 284 | */ |
|
| 285 | public static function write($text = '', $foreground = null, $background = null) |
|
| 286 | { |
|
| 287 | if (is_array($text)) |
|
| 288 | { |
|
| 289 | $text = implode(PHP_EOL, $text); |
|
| 290 | } |
|
| 291 | ||
| 292 | if ($foreground or $background) |
|
| 293 | { |
|
| 294 | $text = static::color($text, $foreground, $background); |
|
| 295 | } |
|
| 296 | ||
| 297 | fwrite(STDOUT, $text.PHP_EOL); |
|
| 298 | } |
|
| 299 | ||
| 300 | //-------------------------------------------------------------------- |
|
| 301 | ||
| @@ 307-320 (lines=14) @@ | ||
| 304 | * |
|
| 305 | * @param string|array $text the text to output, or array of errors |
|
| 306 | */ |
|
| 307 | public static function error($text = '', $foreground = 'light_red', $background = null) |
|
| 308 | { |
|
| 309 | if (is_array($text)) |
|
| 310 | { |
|
| 311 | $text = implode(PHP_EOL, $text); |
|
| 312 | } |
|
| 313 | ||
| 314 | if ($foreground OR $background) |
|
| 315 | { |
|
| 316 | $text = static::color($text, $foreground, $background); |
|
| 317 | } |
|
| 318 | ||
| 319 | fwrite(STDERR, $text.PHP_EOL); |
|
| 320 | } |
|
| 321 | ||
| 322 | //-------------------------------------------------------------------- |
|
| 323 | ||