Completed
Pull Request — master (#112)
by Alessandro
07:59
created

Text::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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