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

TextResult   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 33
ccs 6
cts 8
cp 0.75
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 4 1
A writeToFile() 0 4 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