OutputWatcher   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 133
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 89.47%

Importance

Changes 0
Metric Value
dl 0
loc 133
ccs 34
cts 38
cp 0.8947
rs 10
c 0
b 0
f 0
wmc 15
lcom 1
cbo 1

15 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A write() 0 5 1
A writeln() 0 4 1
A setVerbosity() 0 4 1
A getVerbosity() 0 4 1
A setDecorated() 0 4 1
A isDecorated() 0 4 1
A setFormatter() 0 4 1
A getFormatter() 0 4 1
A setWasWritten() 0 4 1
A getWasWritten() 0 4 1
A isQuiet() 0 4 1
A isVerbose() 0 4 1
A isVeryVerbose() 0 4 1
A isDebug() 0 4 1
1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Console\Output;
9
10
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
class OutputWatcher implements OutputInterface
14
{
15
    /**
16
     * @var OutputInterface
17
     */
18
    private $output;
19
20
    /**
21
     * @var bool
22
     */
23
    private $wasWritten = false;
24
25
    /**
26
     * @param OutputInterface $output
27
     */
28 17
    public function __construct(OutputInterface $output)
29
    {
30 17
        $this->output = $output;
31 17
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 17
    public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
37
    {
38 17
        $this->wasWritten = true;
39 17
        $this->output->write($messages, $newline, $type);
40 17
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 18
    public function writeln($messages, $type = self::OUTPUT_NORMAL)
46
    {
47 18
        $this->write($messages, true, $type);
48 18
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53 1
    public function setVerbosity($level)
54
    {
55 1
        $this->output->setVerbosity($level);
56 1
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61 17
    public function getVerbosity()
62
    {
63 17
        return $this->output->getVerbosity();
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69 1
    public function setDecorated($decorated)
70
    {
71 1
        $this->output->setDecorated($decorated);
72 1
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77 17
    public function isDecorated()
78
    {
79 17
        return $this->output->isDecorated();
80
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85 1
    public function setFormatter(OutputFormatterInterface $formatter)
86
    {
87 1
        $this->output->setFormatter($formatter);
88 1
    }
89
90
    /**
91
     * {@inheritdoc}
92
     */
93 1
    public function getFormatter()
94
    {
95 1
        return $this->output->getFormatter();
96
    }
97
98
    /**
99
     * @param boolean $wasWritten
100
     */
101 18
    public function setWasWritten($wasWritten)
102
    {
103 18
        $this->wasWritten = $wasWritten;
104 18
    }
105
106
    /**
107
     * @return boolean
108
     */
109 1
    public function getWasWritten()
110
    {
111 1
        return $this->wasWritten;
112
    }
113
114
    /**
115
     * {@inheritdoc}
116
     */
117
    public function isQuiet()
118
    {
119
        return self::VERBOSITY_QUIET === $this->getVerbosity();
120
    }
121
122
    /**
123
     * {@inheritdoc}
124
     */
125
    public function isVerbose()
126
    {
127
        return self::VERBOSITY_VERBOSE <= $this->getVerbosity();
128
    }
129
130
    /**
131
     * {@inheritdoc}
132
     */
133 9
    public function isVeryVerbose()
134
    {
135 9
        return self::VERBOSITY_VERY_VERBOSE <= $this->getVerbosity();
136
    }
137
138
    /**
139
     * {@inheritdoc}
140
     */
141 9
    public function isDebug()
142
    {
143 9
        return self::VERBOSITY_DEBUG <= $this->getVerbosity();
144
    }
145
}
146