Composer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
cc 1
nc 1
nop 2
crap 1
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