Completed
Pull Request — master (#84)
by Alessandro
02:34
created

Clover   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A process() 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
namespace Paraunit\Coverage\Processor;
4
5
use Paraunit\Configuration\OutputFile;
6
use Paraunit\Proxy\Coverage\CodeCoverage;
7
use SebastianBergmann\CodeCoverage\Report\Clover as PHPUnitClover;
8
9
/**
10
 * Class Clover
11
 * @package Paraunit\Proxy\Coverage
12
 */
13 View Code Duplication
class Clover 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...
14
{
15
    /** @var Clover */
16
    private $clover;
17
18
    /** @var  OutputFile */
19
    private $targetFile;
20
21
    /**
22
     * Clover constructor.
23
     * @param OutputFile $targetFile
24
     */
25 2
    public function __construct(OutputFile $targetFile)
26
    {
27 2
        $this->clover = new PHPUnitClover();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \SebastianBergmann\C...overage\Report\Clover() of type object<SebastianBergmann...Coverage\Report\Clover> is incompatible with the declared type object<Paraunit\Coverage\Processor\Clover> of property $clover.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
28 2
        $this->targetFile = $targetFile;
29 2
    }
30
31
    /**
32
     * @param CodeCoverage $codeCoverage
33
     * @throws \RuntimeException
34
     */
35 1
    public function process(CodeCoverage $codeCoverage)
36
    {
37 1
        $this->clover->process($codeCoverage, $this->targetFile->getFilePath());
0 ignored issues
show
Unused Code introduced by
The call to Clover::process() has too many arguments starting with $this->targetFile->getFilePath().

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
38 1
    }
39
}
40