Composer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 100 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A isEnabled() 4 4 1
A isUndefined() 4 4 1
A setEnabled() 7 7 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\Domain;
4
5
use PhpGitHooks\Module\Configuration\Model\ToolInterface;
6
7 View Code Duplication
class Composer implements ToolInterface
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...
8
{
9
    /**
10
     * @var Enabled
11
     */
12
    private $enabled;
13
    /**
14
     * @var Undefined
15
     */
16
    private $undefined;
17
18
    /**
19
     * Composer constructor.
20
     *
21
     * @param Undefined $undefined
22
     * @param Enabled   $enabled
23
     */
24 6
    public function __construct(Undefined $undefined, Enabled $enabled)
25
    {
26 6
        $this->enabled = $enabled;
27 6
        $this->undefined = $undefined;
28 6
    }
29
30
    /**
31
     * @return bool
32
     */
33 4
    public function isEnabled()
34
    {
35 4
        return $this->enabled->value();
36
    }
37
38
    /**
39
     * @return bool
40
     */
41 3
    public function isUndefined()
42
    {
43 3
        return $this->undefined->value();
44
    }
45
46
    /**
47
     * @param Enabled $enabled
48
     *
49
     * @return Composer
50
     */
51 2
    public function setEnabled(Enabled $enabled)
52
    {
53 2
        return new self(
54 2
            new Undefined(false),
55 2
            $enabled
56
        );
57
    }
58
}
59