PHP Classes

File: src/Types/ConsoleLevel.php

Recommend this page to a friend!
  Classes of Andrey Postal   EasyCLI   src/Types/ConsoleLevel.php   Download  
File: src/Types/ConsoleLevel.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: EasyCLI
Create CLI applications using handler functions
Author: By
Last change:
Date: 4 months ago
Size: 485 bytes
 

Contents

Class file image Download
<?php
namespace Andrey\Cli\Types;

enum ConsoleLevel
{
    case
NORMAL;
    case
INFO;
    case
WARNING;
    case
ERROR;
    case
SUCCESS;
    case
HIGHLIGHT;

    public function
getColor(): string
   
{
        return
match($this) {
           
self::NORMAL => "\e[0m",
           
self::INFO => "\e[94m",
           
self::WARNING => "\e[93m",
           
self::ERROR => "\e[91m",
           
self::SUCCESS => "\e[92m",
           
self::HIGHLIGHT => "\e[1;95m",
        };
    }
}