Completed
Pull Request — master (#12)
by Harry
02:36
created

BufferDiffOutput::getWritten()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Graze\ParallelProcess\Test;
4
5
use Graze\DiffRenderer\DiffConsoleOutput;
6
use Symfony\Component\Console\Output\ConsoleOutput;
7
8
class BufferDiffOutput extends DiffConsoleOutput
9
{
10
    /** @var array */
11
    protected $written;
12
13
    /**
14
     * BufferDiffOutput constructor.
15
     */
16
    public function __construct()
17
    {
18
        $dummy = new ConsoleOutput();
19
        parent::__construct($dummy);
20
    }
21
22
    /**
23
     * @param array|string $messages
24
     * @param bool         $newline
25
     * @param int          $options
26
     */
27
    public function write($messages, $newline = false, $options = 0)
28
    {
29
        $messages = (array) $messages;
30
        $this->written[] = $messages;
31
    }
32
33
    /**
34
     * @param array|string $messages
35
     * @param int          $options
36
     */
37
    public function writeln($messages, $options = 0)
38
    {
39
        $messages = (array) $messages;
40
        $this->written[] = $messages;
41
    }
42
43
    /**
44
     * @param string|\string[] $messages
45
     * @param bool             $newline
46
     * @param int              $options
47
     */
48
    public function reWrite($messages, $newline = false, $options = 0)
49
    {
50
        $messages = (array) $messages;
51
        $this->written[] = $messages;
52
    }
53
54
    /**
55
     * @return array
56
     */
57
    public function getWritten()
58
    {
59
        return $this->written;
60
    }
61
}
62