Test Failed
Push — master ( 772f18...8c594b )
by Alec
03:05
created

Theme::yellow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * User: alec
4
 * Date: 24.12.18
5
 * Time: 15:17
6
 */
7
declare(strict_types=1);
8
9
namespace AlecRabbit\Tools\Internal;
10
11
use AlecRabbit\ConsoleColour;
12
13
class Theme extends ConsoleColour implements ThemesInterface
14
{
15
    private $do;
16
17
    public function __construct($color = false)
18
    {
19
        $this->do = $color;
20
        parent::__construct();
21
        $this->setDefaultThemes();
22
    }
23
24
    protected function setDefaultThemes(): void
25
    {
26
        $this->addTheme(static::DARK, 'dark');
27
        $this->addTheme(static::COMMENT, 'yellow');
28
        $this->addTheme(static::INFO, 'green');
29
        $this->addTheme(static::RED, 'red');
30
    }
31
32
    public function comment($text): string
33
    {
34
        return
35
            $this->apply(static::COMMENT, $text);
36
    }
37
38
    public function yellow($text): string
39
    {
40
        return
41
            $this->apply(static::COMMENT, $text);
42
    }
43
44
    public function apply($style, $text): string
45
    {
46
        return $this->do ? parent::apply($style, $text) : (string)$text;
47
    }
48
49
    public function red($text): string
50
    {
51
        return
52
            $this->apply(static::RED, $text);
53
    }
54
55
    public function info($text): string
56
    {
57
        return
58
            $this->apply(static::INFO, $text);
59
    }
60
61
    public function green($text): string
62
    {
63
        return
64
            $this->apply(static::INFO, $text);
65
    }
66
67
    public function dark($text): string
68
    {
69
        return
70
            $this->apply(static::DARK, $text);
71
    }
72
}