Code Duplication    Length = 28-28 lines in 5 locations

src/PhpGitHooks/Module/Configuration/Service/CommitMsgFactory.php 1 location

@@ 10-37 (lines=28) @@
7
use PhpGitHooks\Module\Configuration\Domain\RegularExpression;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
10
class CommitMsgFactory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return CommitMsg
16
     */
17
    public static function fromArray(array $data)
18
    {
19
        return  new CommitMsg(
20
            new Undefined(false),
21
            new Enabled($data['enabled']),
22
            new RegularExpression($data['regular-expression'])
23
        );
24
    }
25
26
    /**
27
     * @return CommitMsg
28
     */
29
    public static function setUndefined()
30
    {
31
        return new CommitMsg(
32
            new Undefined(true),
33
            new Enabled(false),
34
            new RegularExpression(null)
35
        );
36
    }
37
}
38

src/PhpGitHooks/Module/Configuration/Service/PhpCsFactory.php 1 location

@@ 10-37 (lines=28) @@
7
use PhpGitHooks\Module\Configuration\Domain\PhpCsStandard;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
10
class PhpCsFactory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return PhpCs
16
     */
17
    public static function fromArray(array $data)
18
    {
19
        return new PhpCs(
20
            new Undefined(false),
21
            new Enabled($data['enabled']),
22
            new PhpCsStandard($data['standard'])
23
        );
24
    }
25
26
    /**
27
     * @return PhpCs
28
     */
29
    public static function setUndefined()
30
    {
31
        return new PhpCs(
32
            new Undefined(true),
33
            new Enabled(false),
34
            new PhpCsStandard(null)
35
        );
36
    }
37
}
38

src/PhpGitHooks/Module/Configuration/Service/PhpMdFactory.php 1 location

@@ 10-37 (lines=28) @@
7
use PhpGitHooks\Module\Configuration\Domain\PhpMdOptions;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
10
class PhpMdFactory
11
{
12
    /**
13
     * @param $data
14
     *
15
     * @return PhpMd
16
     */
17
    public static function fromArray($data)
18
    {
19
        return new PhpMd(
20
            new Undefined(false),
21
            new Enabled($data['enabled']),
22
            new PhpMdOptions($data['options'])
23
        );
24
    }
25
26
    /**
27
     * @return PhpMd
28
     */
29
    public static function setUndefined()
30
    {
31
        return new PhpMd(
32
            new Undefined(true),
33
            new Enabled(false),
34
            new PhpMdOptions(null)
35
        );
36
    }
37
}
38

src/PhpGitHooks/Module/Configuration/Service/PhpUnitGuardCoverageFactory.php 1 location

@@ 10-37 (lines=28) @@
7
use PhpGitHooks\Module\Configuration\Domain\PhpUnitGuardCoverage;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
10
class PhpUnitGuardCoverageFactory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return PhpUnitGuardCoverage
16
     */
17
    public static function build(array $data)
18
    {
19
        return new PhpUnitGuardCoverage(
20
            new Undefined(false),
21
            new Enabled($data['enabled']),
22
            new Message($data['message'])
23
        );
24
    }
25
26
    /**
27
     * @return PhpUnitGuardCoverage
28
     */
29
    public static function setUndefined()
30
    {
31
        return new PhpUnitGuardCoverage(
32
            new Undefined(true),
33
            new Enabled(false),
34
            new Message(null)
35
        );
36
    }
37
}
38

src/PhpGitHooks/Module/Configuration/Service/PhpUnitStrictCoverageFactory.php 1 location

@@ 10-37 (lines=28) @@
7
use PhpGitHooks\Module\Configuration\Domain\PhpUnitStrictCoverage;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
10
class PhpUnitStrictCoverageFactory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return PhpUnitStrictCoverage
16
     */
17
    public static function fromArray(array $data)
18
    {
19
        return new PhpUnitStrictCoverage(
20
            new Undefined(false),
21
            new Enabled($data['enabled']),
22
            new MinimumStrictCoverage($data['minimum'])
23
        );
24
    }
25
26
    /**
27
     * @return PhpUnitStrictCoverage
28
     */
29
    public static function setUndefined()
30
    {
31
        return new PhpUnitStrictCoverage(
32
            new Undefined(true),
33
            new Enabled(false),
34
            new MinimumStrictCoverage(null)
35
        );
36
    }
37
}
38