Completed
Push — master ( ffecda...e79dfa )
by Benjamin
02:28
created

MemoryWriter::getOutput()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Alpixel\Bundle\CronBundle\Command;
4
5
use Symfony\Component\Console\Output\Output;
6
7
/**
8
 * MemoryWriter implements OutputInterface, writing to an internal buffer.
9
 */
10
class MemoryWriter extends Output
11
{
12
    protected $backingStore = '';
13
14
    public function __construct($verbosity = self::VERBOSITY_NORMAL)
15
    {
16
        parent::__construct($verbosity);
17
    }
18
19
    public function doWrite($message, $newline)
20
    {
21
        $this->backingStore .= $message;
22
        if ($newline) {
23
            $this->backingStore .= "\n";
24
        }
25
    }
26
27
    public function getOutput()
28
    {
29
        return $this->backingStore;
30
    }
31
32
    public function clear()
33
    {
34
        $this->backingStore = '';
35
    }
36
}
37