Completed
Push — master ( 4006e3...35fa08 )
by Flo
07:46
created

Output::writeEmptyLine()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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