1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90:
<?php
namespace Faulancer\Console;
class Output
{
protected static $foregroundColors = [
'black' => "\033[0;30m",
'dark_gray' => "\033[1;30m",
'blue' => "\033[0;34m",
'light_blue' => "\033[1;34m",
'green' => "\033[0;32m",
'light_green' => "\033[1;32m",
'cyan' => "\033[0;36m",
'light_cyan' => "\033[1;36m",
'red' => "\033[0;31m",
'light_red' => "\033[1;31m",
'purple' => "\033[0;35m",
'light_purple' => "\033[1;35m",
'brown' => "\033[0;33m",
'yellow' => "\033[1;33m",
'light_gray' => "\033[0;37m",
'white' => "\033[1;37m",
'default' => "\033[0m"
];
protected static $backgroundColors = [
'black' => '40',
'red' => '41',
'green' => '42',
'yellow' => '43',
'blue' => '44',
'magenta' => '45',
'cyan' => '46',
'light_gray' => '47'
];
public static function writeLine($message = '', $type = 'notice')
{
switch ($type) {
case 'success':
print self::$foregroundColors['light_green'];
break;
case 'notice':
print self::$foregroundColors['light_blue'];
break;
case 'warning':
print self::$foregroundColors['yellow'];
break;
case 'error':
print self::$foregroundColors['light_red'];
break;
}
print $message . self::$foregroundColors['default'] . PHP_EOL;
}
public static function writeEmptyLine()
{
print PHP_EOL;
}
}