Posix   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 39
c 1
b 0
f 0
dl 0
loc 54
ccs 37
cts 37
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setTags() 0 49 1
1
<?php
2
3
namespace kalanis\kw_clipr\Output;
4
5
6
/**
7
 * Class Posix
8
 * @package kalanis\kw_clipr\Output
9
 * @link https://www.shellhacks.com/bash-colors/
10
 */
11
class Posix extends AOutput
12
{
13
    protected string $closeSequence = "\e[0m";
14
    protected string $formatBackSequence = "\033[%dD";
15
16 1
    public function setTags(): void
17
    {
18 1
        parent::setTags();
19
        # format style
20 1
        $this->addTranslation('normal', "\e[0m");
21 1
        $this->addTranslation('under', "\e[4m");
22 1
        $this->addTranslation('blink', "\e[5m");
23
24
        # default ones
25
        # foreground colors
26 1
        $this->addTranslation('black', "\e[30m");
27 1
        $this->addTranslation('red', "\e[31m");
28 1
        $this->addTranslation('green', "\e[32m");
29 1
        $this->addTranslation('brown', "\e[33m");
30 1
        $this->addTranslation('blue', "\e[34m");
31 1
        $this->addTranslation('purple', "\e[35m");
32 1
        $this->addTranslation('cyan', "\e[36m");
33 1
        $this->addTranslation('gray', "\e[37m");
34
35
        # background colors
36 1
        $this->addTranslation('blackbg', "\e[40m");
37 1
        $this->addTranslation('redbg', "\e[41m");
38 1
        $this->addTranslation('greenbg', "\e[42m");
39 1
        $this->addTranslation('brownbg', "\e[43m");
40 1
        $this->addTranslation('bluebg', "\e[44m");
41 1
        $this->addTranslation('purplebg', "\e[45m");
42 1
        $this->addTranslation('cyanbg', "\e[46m");
43 1
        $this->addTranslation('graybg', "\e[47m");
44
45
        # stronger ones
46
        # foreground colors
47 1
        $this->addTranslation('dgray', "\e[1;30m");
48 1
        $this->addTranslation('lred', "\e[1;31m");
49 1
        $this->addTranslation('lgreen', "\e[1;32m");
50 1
        $this->addTranslation('yellow', "\e[1;33m");
51 1
        $this->addTranslation('lblue', "\e[1;34m");
52 1
        $this->addTranslation('magenta', "\e[1;35m");
53 1
        $this->addTranslation('lcyan', "\e[1;36m");
54 1
        $this->addTranslation('white', "\e[1;37m");
55
56
        # background colors
57 1
        $this->addTranslation('dgraybg', "\e[1;40m");
58 1
        $this->addTranslation('lredbg', "\e[1;41m");
59 1
        $this->addTranslation('lgreenbg', "\e[1;42m");
60 1
        $this->addTranslation('yellowbg', "\e[1;43m");
61 1
        $this->addTranslation('lbluebg', "\e[1;44m");
62 1
        $this->addTranslation('magentabg', "\e[1;45m");
63 1
        $this->addTranslation('lcyanbg', "\e[1;46m");
64 1
        $this->addTranslation('whitebg', "\e[1;47m");
65 1
    }
66
}
67