Completed
Pull Request — master (#79)
by Alessandro
05:47
created

TextResult::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Paraunit\Proxy\Coverage;
4
5
use Paraunit\Configuration\OutputFile;
6
use SebastianBergmann\CodeCoverage\Report\Text;
7
8
/**
9
 * Class TextResult
10
 * @package Paraunit\Proxy\Coverage
11
 */
12
class TextResult
13
{
14
    /** @var  Text */
15
    private $text;
16
17
    /**
18
     * TextResult constructor.
19
     */
20 2
    public function __construct()
21
    {
22 2
        $this->text = new Text(50, 90, false, false);
23 2
    }
24
25
    /**
26
     * @param CodeCoverage $coverage
27
     * @param bool $showColors
28
     * @return string The actual text coverage
29
     */
30
    public function process(CodeCoverage $coverage, $showColors = false)
31
    {
32
        return $this->text->process($coverage, $showColors);
33
    }
34
35
    /**
36
     * @param CodeCoverage $coverage
37
     * @param OutputFile $outputFile
38
     * @throws \RuntimeException
39
     */
40 1
    public function writeToFile(CodeCoverage $coverage, OutputFile $outputFile)
41
    {
42 1
        file_put_contents($outputFile->getFilePath(), $this->text->process($coverage, false));
43 1
    }
44
}
45