Passed
Branch master (9c9e82)
by ANTHONIUS
01:35
created

Text   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 33
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
A getProcessorClass() 0 3 1
A getType() 0 3 1
A getOutputType() 0 4 2
1
<?php
2
3
namespace Doyo\Bridge\CodeCoverage\Report;
4
5
use Doyo\Bridge\CodeCoverage\Console\ConsoleIO;
6
use Doyo\Bridge\CodeCoverage\ProcessorInterface;
7
8
class Text extends AbstractReportProcessor
9
{
10
    protected $defaultOptions = [
11
        'target' => 'console'
12
    ];
13
14 4
    public function getProcessorClass(): string
15
    {
16 4
        return \SebastianBergmann\CodeCoverage\Report\Text::class;
17
    }
18
19 4
    public function getOutputType(): string
20
    {
21
22 4
        return $this->getTarget() !== 'console' ? static::OUTPUT_FILE:static::OUTPUT_CONSOLE;
23
    }
24
25 1
    public function getType(): string
26
    {
27 1
        return 'text';
28
    }
29
30 2
    public function process(ProcessorInterface $processor, ConsoleIO $consoleIO)
31
    {
32 2
        $reportProcessor = $this->processor;
33 2
        $coverage = $processor->getCodeCoverage();
34 2
        $target = $this->target;
35
36 2
        $output = $reportProcessor->process($coverage);
37 2
        if('console' === $target){
38 1
            $consoleIO->coverageInfo($output);
39
        }else{
40 1
            file_put_contents($target, $output);
41
        }
42
    }
43
}
44