Completed
Branch output_parsers_refactor (69b7d7)
by Alessandro
02:50
created

OutputContainer::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Paraunit\Printer;
4
5
/**
6
 * Class OutputContainer.
7
 */
8
class OutputContainer
9
{
10
    /**
11
     * @var string[]
12
     */
13
    protected $fileNames;
14
15
    /**
16
     * @var string[]
17
     */
18
    protected $outputBuffer;
19
20
    /**
21
     * @var string
22
     */
23
    protected $tag;
24
25
    /**
26
     * @var string
27
     */
28
    protected $title;
29
30
    /**
31
     * @param string $tag
32
     * @param string $title
33
     */
34 37
    public function __construct($tag, $title)
35
    {
36 37
        $this->tag = $tag;
37 37
        $this->title = $title;
38 37
        $this->fileNames = array();
39 37
        $this->fileNames = array();
40 37
        $this->outputBuffer = array();
41 37
    }
42
43
    /**
44
     * @param string $fileName
45
     */
46 14
    public function addFileName($fileName)
47
    {
48 14
        $this->fileNames[] = $fileName;
49 14
    }
50
51
    /**
52
     * @param string|array $output
53
     */
54 10
    public function addToOutputBuffer($output)
55
    {
56 10
        if (is_array($output)) {
57 10
            foreach ($output as $single) {
58 10
                $this->outputBuffer[] = $single;
59 10
            }
60 10
        } else {
61
            $this->outputBuffer[] = $output;
62
        }
63 10
    }
64
65
    /**
66
     * @return \string[]
67
     */
68 6
    public function getFileNames()
69
    {
70 6
        return $this->fileNames;
71
    }
72
73
    /**
74
     * @return string[]
75
     */
76 26
    public function getOutputBuffer()
77
    {
78 26
        return $this->outputBuffer;
79
    }
80
81
    /**
82
     * @return int
83
     */
84 7
    public function countFiles()
85
    {
86 7
        return count($this->fileNames);
87
    }
88
89
    /**
90
     * @return string
91
     */
92 6
    public function getTag()
93
    {
94 6
        return $this->tag;
95
    }
96
97
    /**
98
     * @return string
99
     */
100 6
    public function getTitle()
101
    {
102 6
        return $this->title;
103
    }
104
}
105