Completed
Branch guard_coverage (f2aaf0)
by Pablo
03:07
created

PhpUnitGuardCoverageFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 4
dl 28
loc 28
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 8 8 1
A setUndefined() 8 8 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 PhpGitHooks\Module\Configuration\Service;
4
5
use PhpGitHooks\Module\Configuration\Domain\Enabled;
6
use PhpGitHooks\Module\Configuration\Domain\Message;
7
use PhpGitHooks\Module\Configuration\Domain\PhpUnitGuardCoverage;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
10 View Code Duplication
class PhpUnitGuardCoverageFactory
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...
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return PhpUnitGuardCoverage
16
     */
17 1
    public static function build(array $data)
18
    {
19 1
        return new PhpUnitGuardCoverage(
20 1
            new Undefined(false),
21 1
            new Enabled($data['enabled']),
22 1
            new Message($data['message'])
23
        );
24
    }
25
26
    /**
27
     * @return PhpUnitGuardCoverage
28
     */
29 3
    public static function setUndefined()
30
    {
31 3
        return new PhpUnitGuardCoverage(
32 3
            new Undefined(true),
33 3
            new Enabled(false),
34 3
            new Message(null)
35
        );
36
    }
37
}
38