Code Duplication    Length = 79-81 lines in 5 locations

src/PhpGitHooks/Module/Configuration/Domain/CommitMsg.php 1 location

@@ 7-87 (lines=81) @@
4
5
use PhpGitHooks\Module\Configuration\Model\ToolInterface;
6
7
class CommitMsg implements ToolInterface
8
{
9
    /**
10
     * @var Enabled
11
     */
12
    private $enabled;
13
    /**
14
     * @var RegularExpression
15
     */
16
    private $regularExpression;
17
    /**
18
     * @var Undefined
19
     */
20
    private $undefined;
21
22
    /**
23
     * CommitMsg constructor.
24
     *
25
     * @param Undefined         $undefined
26
     * @param Enabled           $enabled
27
     * @param RegularExpression $regularExpression
28
     */
29
    public function __construct(Undefined $undefined, Enabled $enabled, RegularExpression $regularExpression)
30
    {
31
        $this->enabled = $enabled;
32
        $this->regularExpression = $regularExpression;
33
        $this->undefined = $undefined;
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    public function isEnabled()
40
    {
41
        return $this->enabled->value();
42
    }
43
44
    /**
45
     * @return RegularExpression
46
     */
47
    public function getRegularExpression()
48
    {
49
        return $this->regularExpression;
50
    }
51
52
    /**
53
     * @return bool
54
     */
55
    public function isUndefined()
56
    {
57
        return $this->undefined->value();
58
    }
59
60
    /**
61
     * @param Enabled $enabled
62
     *
63
     * @return CommitMsg
64
     */
65
    public function setEnabled(Enabled $enabled)
66
    {
67
        return new self(
68
            new Undefined(false),
69
            $enabled,
70
            $this->regularExpression
71
        );
72
    }
73
74
    /**
75
     * @param RegularExpression $regularExpression
76
     *
77
     * @return CommitMsg
78
     */
79
    public function addRegularExpression(RegularExpression $regularExpression)
80
    {
81
        return new self(
82
            $this->undefined,
83
            $this->enabled,
84
            $regularExpression
85
        );
86
    }
87
}
88

src/PhpGitHooks/Module/Configuration/Domain/PhpCs.php 1 location

@@ 7-85 (lines=79) @@
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
    /**
23
     * PhpCs constructor.
24
     *
25
     * @param Undefined     $undefined
26
     * @param Enabled       $enabled
27
     * @param PhpCsStandard $standard
28
     */
29
    public function __construct(Undefined $undefined, Enabled $enabled, PhpCsStandard $standard)
30
    {
31
        $this->undefined = $undefined;
32
        $this->enabled = $enabled;
33
        $this->standard = $standard;
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    public function isEnabled()
40
    {
41
        return $this->enabled->value();
42
    }
43
44
    /**
45
     * @return bool
46
     */
47
    public function isUndefined()
48
    {
49
        return $this->undefined->value();
50
    }
51
52
    /**
53
     * @return PhpCsStandard
54
     */
55
    public function getStandard()
56
    {
57
        return $this->standard;
58
    }
59
60
    /**
61
     * @return ToolInterface
62
     */
63
    public function setEnabled(Enabled $enabled)
64
    {
65
        return new self(
66
            new Undefined(false),
67
            $enabled,
68
            new PhpCsStandard(null)
69
        );
70
    }
71
72
    /**
73
     * @param PhpCsStandard $standard
74
     *
75
     * @return PhpCs
76
     */
77
    public function addStandard(PhpCsStandard $standard)
78
    {
79
        return new self(
80
            $this->undefined,
81
            $this->enabled,
82
            $standard
83
        );
84
    }
85
}
86

src/PhpGitHooks/Module/Configuration/Domain/PhpMd.php 1 location

@@ 7-87 (lines=81) @@
4
5
use PhpGitHooks\Module\Configuration\Model\ToolInterface;
6
7
class PhpMd implements ToolInterface
8
{
9
    /**
10
     * @var Undefined
11
     */
12
    private $undefined;
13
    /**
14
     * @var Enabled
15
     */
16
    private $enabled;
17
    /**
18
     * @var PhpMdOptions
19
     */
20
    private $options;
21
22
    /**
23
     * PhpMd constructor.
24
     *
25
     * @param Undefined    $undefined
26
     * @param Enabled      $enabled
27
     * @param PhpMdOptions $options
28
     */
29
    public function __construct(Undefined $undefined, Enabled $enabled, PhpMdOptions $options)
30
    {
31
        $this->undefined = $undefined;
32
        $this->enabled = $enabled;
33
        $this->options = $options;
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    public function isEnabled()
40
    {
41
        return $this->enabled->value();
42
    }
43
44
    /**
45
     * @return bool
46
     */
47
    public function isUndefined()
48
    {
49
        return $this->undefined->value();
50
    }
51
52
    /**
53
     * @param Enabled $enabled
54
     *
55
     * @return PhpMd
56
     */
57
    public function setEnabled(Enabled $enabled)
58
    {
59
        return new self(
60
            new Undefined(false),
61
            $enabled,
62
            $this->options
63
        );
64
    }
65
66
    /**
67
     * @return PhpMdOptions
68
     */
69
    public function getOptions()
70
    {
71
        return $this->options;
72
    }
73
74
    /**
75
     * @param PhpMdOptions $options
76
     *
77
     * @return PhpMd
78
     */
79
    public function setOptions(PhpMdOptions $options)
80
    {
81
        return new self(
82
            $this->undefined,
83
            $this->enabled,
84
            $options
85
        );
86
    }
87
}
88

src/PhpGitHooks/Module/Configuration/Domain/PhpUnitStrictCoverage.php 1 location

@@ 7-87 (lines=81) @@
4
5
use PhpGitHooks\Module\Configuration\Model\ToolInterface;
6
7
class PhpUnitStrictCoverage implements ToolInterface
8
{
9
    /**
10
     * @var Undefined
11
     */
12
    private $undefined;
13
    /**
14
     * @var Enabled
15
     */
16
    private $enabled;
17
    /**
18
     * @var MinimumStrictCoverage
19
     */
20
    private $minimumStrictCoverage;
21
22
    /**
23
     * PhpUnitStrictCoverage constructor.
24
     *
25
     * @param Undefined             $undefined
26
     * @param Enabled               $enabled
27
     * @param MinimumStrictCoverage $minimumStrictCoverage
28
     */
29
    public function __construct(Undefined $undefined, Enabled $enabled, MinimumStrictCoverage $minimumStrictCoverage)
30
    {
31
        $this->undefined = $undefined;
32
        $this->enabled = $enabled;
33
        $this->minimumStrictCoverage = $minimumStrictCoverage;
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    public function isEnabled()
40
    {
41
        return $this->enabled->value();
42
    }
43
44
    /**
45
     * @return bool
46
     */
47
    public function isUndefined()
48
    {
49
        return $this->undefined->value();
50
    }
51
52
    /**
53
     * @return MinimumStrictCoverage
54
     */
55
    public function getMinimumStrictCoverage()
56
    {
57
        return $this->minimumStrictCoverage;
58
    }
59
60
    /**
61
     * @param MinimumStrictCoverage $strictCoverage
62
     *
63
     * @return PhpUnitStrictCoverage
64
     */
65
    public function setStrictCoverage(MinimumStrictCoverage $strictCoverage)
66
    {
67
        return new self(
68
            $this->undefined,
69
            $this->enabled,
70
            $strictCoverage
71
        );
72
    }
73
74
    /**
75
     * @param Enabled $enabled
76
     *
77
     * @return PhpUnitStrictCoverage
78
     */
79
    public function setEnabled(Enabled $enabled)
80
    {
81
        return new self(
82
            new Undefined(false),
83
            $enabled,
84
            $this->minimumStrictCoverage
85
        );
86
    }
87
}
88

src/PhpGitHooks/Module/Configuration/Domain/PhpUnitGuardCoverage.php 1 location

@@ 7-87 (lines=81) @@
4
5
use PhpGitHooks\Module\Configuration\Model\ToolInterface;
6
7
class PhpUnitGuardCoverage implements ToolInterface
8
{
9
    /**
10
     * @var Undefined
11
     */
12
    private $undefined;
13
    /**
14
     * @var Enabled
15
     */
16
    private $enabled;
17
    /**
18
     * @var Message
19
     */
20
    private $warningMessage;
21
22
    /**
23
     * PhpUnitGuardCoverage constructor.
24
     *
25
     * @param Undefined $undefined
26
     * @param Enabled   $enabled
27
     * @param Message   $warningMessage
28
     */
29
    public function __construct(Undefined $undefined, Enabled $enabled, Message $warningMessage)
30
    {
31
        $this->undefined = $undefined;
32
        $this->enabled = $enabled;
33
        $this->warningMessage = $warningMessage;
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    public function isEnabled()
40
    {
41
        return $this->enabled->value();
42
    }
43
44
    /**
45
     * @return bool
46
     */
47
    public function isUndefined()
48
    {
49
        return $this->undefined->value();
50
    }
51
52
    /**
53
     * @return Message
54
     */
55
    public function getWarningMessage()
56
    {
57
        return $this->warningMessage;
58
    }
59
60
    /**
61
     * @param Enabled $enabled
62
     *
63
     * @return PhpUnitGuardCoverage
64
     */
65
    public function setEnabled(Enabled $enabled)
66
    {
67
        return new self(
68
            new Undefined(false),
69
            $enabled,
70
            $this->warningMessage
71
        );
72
    }
73
74
    /**
75
     * @param Message $message
76
     *
77
     * @return PhpUnitGuardCoverage
78
     */
79
    public function setWarningMessage(Message $message)
80
    {
81
        return new self(
82
            $this->undefined,
83
            $this->enabled,
84
            $message
85
        );
86
    }
87
}
88