Xml   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 32
loc 32
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A process() 4 4 1
A getConsoleOptionName() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Paraunit\Coverage\Processor;
6
7
use Paraunit\Configuration\OutputPath;
8
use PHPUnit\Runner\Version;
9
use SebastianBergmann\CodeCoverage\CodeCoverage;
10
use SebastianBergmann\CodeCoverage\Report\Xml\Facade;
11
12
/**
13
 * Class XMLResult
14
 * @package Paraunit\Proxy\Coverage
15
 */
16 View Code Duplication
class Xml implements CoverageProcessorInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /** @var Facade */
19
    private $xml;
20
21
    /** @var OutputPath */
22
    private $targetPath;
23
24
    /**
25
     * Xml constructor.
26
     * @param OutputPath $targetPath
27
     */
28 2
    public function __construct(OutputPath $targetPath)
29
    {
30 2
        $this->xml = new Facade(Version::id());
31 2
        $this->targetPath = $targetPath;
32
    }
33
34
    /**
35
     * @param CodeCoverage $codeCoverage
36
     * @throws \RuntimeException
37
     */
38 1
    public function process(CodeCoverage $codeCoverage)
39
    {
40 1
        $this->xml->process($codeCoverage, $this->targetPath->getPath());
41
    }
42
43 26
    public static function getConsoleOptionName(): string
44
    {
45 26
        return 'xml';
46
    }
47
}
48