MemoryWriter::doWrite()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
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