BufferedOutput   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 32
ccs 0
cts 13
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fetch() 0 7 1
A doWrite() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Axstrad\Component\Test\Console\Output;
13
14
use Symfony\Component\Console\Output\Output;
15
16
17
/**
18
 * @author Jean-François Simon <[email protected]>
19
 */
20
class BufferedOutput extends Output
21
{
22
    /**
23
     * @var string
24
     */
25
    private $buffer = '';
26
27
    /**
28
     * Empties buffer and returns its content.
29
     *
30
     * @return string
31
     */
32
    public function fetch()
33
    {
34
        $content = $this->buffer;
35
        $this->buffer = '';
36
37
        return $content;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    protected function doWrite($message, $newline)
44
    {
45
        $this->buffer .= $message;
46
47
        if ($newline) {
48
            $this->buffer .= "\n";
49
        }
50
    }
51
}
52