Completed
Push — master ( 835840...ce2316 )
by Pablo
02:59
created

PhpCs::addStandard()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
rs 9.6666
ccs 6
cts 6
cp 1
cc 1
eloc 6
nc 1
nop 1
crap 1
1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Domain;
4
5
use PhpGitHooks\Module\Configuration\Model\ToolInterface;
6
7
class PhpCs implements ToolInterface
8
{
9
    /**
10
     * @var Undefined
11
     */
12
    private $undefined;
13
    /**
14
     * @var Enabled
15
     */
16
    private $enabled;
17
    /**
18
     * @var PhpCsStandard
19
     */
20
    private $standard;
21
    /**
22
     * @var Ignore
23
     */
24
    private $ignore;
25
26
    /**
27
     * PhpCs constructor.
28
     *
29
     * @param Undefined     $undefined
30
     * @param Enabled       $enabled
31
     * @param PhpCsStandard $standard
32
     * @param Ignore        $ignore
33
     */
34 6
    public function __construct(Undefined $undefined, Enabled $enabled, PhpCsStandard $standard, Ignore $ignore)
35
    {
36 6
        $this->undefined = $undefined;
37 6
        $this->enabled = $enabled;
38 6
        $this->standard = $standard;
39 6
        $this->ignore = $ignore;
40 6
    }
41
42
    /**
43
     * @return bool
44
     */
45 3
    public function isEnabled()
46
    {
47 3
        return $this->enabled->value();
48
    }
49
50
    /**
51
     * @return bool
52
     */
53 2
    public function isUndefined()
54
    {
55 2
        return $this->undefined->value();
56
    }
57
58
    /**
59
     * @return PhpCsStandard
60
     */
61 3
    public function getStandard()
62
    {
63 3
        return $this->standard;
64
    }
65
66
    /**
67
     * @return Ignore
68
     */
69 3
    public function getIgnore()
70
    {
71 3
        return $this->ignore;
72
    }
73
74
    /**
75
     * @return ToolInterface
76
     */
77 2 View Code Duplication
    public function setEnabled(Enabled $enabled)
0 ignored issues
show
Duplication introduced by
This method 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...
78
    {
79 2
        return new self(
80 2
            new Undefined(false),
81 2
            $enabled,
82 2
            new PhpCsStandard(null),
83 2
            new Ignore(null)
84
        );
85
    }
86
87
    /**
88
     * @param PhpCsStandard $standard
89
     *
90
     * @return PhpCs
91
     */
92 1
    public function addStandard(PhpCsStandard $standard)
93
    {
94 1
        return new self(
95 1
            $this->undefined,
96 1
            $this->enabled,
97 1
            $standard,
98 1
            $this->ignore
99
        );
100
    }
101
102
    /**
103
     * @param Ignore $ignore
104
     */
105 1
    public function addIgnore(Ignore $ignore)
106
    {
107 1
        $this->ignore = $ignore;
108 1
    }
109
}
110