| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Console |
||
| 11 | { |
||
| 12 | // actions |
||
| 13 | public const CREATED = 'created'; |
||
| 14 | |||
| 15 | // user colors |
||
| 16 | public const COLOR_RED = 'red'; |
||
| 17 | public const COLOR_GREEN = 'green'; |
||
| 18 | public const COLOR_YELLOW = 'yellow'; |
||
| 19 | |||
| 20 | public const ANSI_COLOR_RED = "\x1b[31m"; |
||
| 21 | public const ANSI_COLOR_GREEN = "\x1b[32m"; |
||
| 22 | public const ANSI_COLOR_YELLOW = "\x1b[33m"; |
||
| 23 | public const ANSI_COLOR_RESET = "\x1b[0m"; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var array|string[] |
||
| 27 | */ |
||
| 28 | private static array $colorMaps = [ |
||
| 29 | self::COLOR_RED => self::ANSI_COLOR_RED, |
||
| 30 | self::COLOR_GREEN => self::ANSI_COLOR_GREEN, |
||
| 31 | self::COLOR_YELLOW => self::ANSI_COLOR_YELLOW, |
||
| 32 | ]; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Console output helper/beautifier |
||
| 36 | * |
||
| 37 | * @param string $str |
||
| 38 | * @param null $color |
||
|
|
|||
| 39 | */ |
||
| 40 | public static function out(string $str, $color = null) : void |
||
| 43 | } |
||
| 44 | } |