MemoryWriter   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 27
c 0
b 0
f 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A doWrite() 0 7 2
A getOutput() 0 4 1
A clear() 0 4 1
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