PreCommitStub   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 17

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 17
dl 0
loc 83
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 1
A createUndefined() 0 9 1
A random() 0 19 1
A createAllEnabled() 0 19 1
1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Tests\Stub;
4
5
use PhpGitHooks\Module\Configuration\Domain\Enabled;
6
use PhpGitHooks\Module\Configuration\Domain\Messages;
7
use PhpGitHooks\Module\Configuration\Domain\PreCommit;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
use PhpGitHooks\Module\Configuration\Model\ExecuteInterface;
10
use PhpGitHooks\Module\Configuration\Service\PreCommitExecuteFactory;
11
use PhpGitHooks\Module\Tests\Infrastructure\Stub\RandomStubInterface;
12
13
class PreCommitStub implements RandomStubInterface
14
{
15
    /**
16
     * @param Undefined        $undefined
17
     * @param Enabled          $enabled
18
     * @param ExecuteInterface $execute
19
     * @param Messages         $messages
20
     *
21
     * @return PreCommit
22
     */
23
    public static function create(
24
        Undefined $undefined,
25
        Enabled $enabled,
26
        ExecuteInterface $execute,
27
        Messages $messages
28
    ) {
29
        return new PreCommit(
30
            $undefined,
31
            $enabled,
32
            $execute,
33
            $messages
34
        );
35
    }
36
37
    /**
38
     * @return PreCommit
39
     */
40
    public static function createUndefined()
41
    {
42
        return self::create(
43
            new Undefined(true),
44
            new Enabled(false),
45
            PreCommitExecuteFactory::setUndefined(),
46
            MessagesStub::random()
47
        );
48
    }
49
50
    /**
51
     * @return PreCommit
52
     */
53
    public static function random()
54
    {
55
        return self::create(
56
            new Undefined(false),
57
            EnabledStub::random(),
58
            PreCommitExecuteStub::create(
59
                ComposerStub::random(),
60
                JsonLintStub::random(),
61
                PhpLintStub::random(),
62
                PhpMdStub::random(),
63
                PhpCsStub::random(),
64
                PhpCsFixerStub::random(),
65
                PhpUnitStub::random(),
66
                PhpUnitStrictCoverageStub::random(),
67
                PhpUnitGuardCoverageStub::random()
68
            ),
69
            MessagesStub::random()
70
        );
71
    }
72
73
    /**
74
     * @return PreCommit
75
     */
76
    public static function createAllEnabled()
77
    {
78
        return self::create(
79
            new Undefined(false),
80
            EnabledStub::create(true),
81
            PreCommitExecuteStub::create(
82
                ComposerStub::createEnabled(),
83
                JsonLintStub::createEnabled(),
84
                PhpLintStub::createEnabled(),
85
                PhpMdStub::createEnabled(),
86
                PhpCsStub::createEnabled(),
87
                PhpCsFixerStub::createEnabled(),
88
                PhpUnitStub::createEnabled(),
89
                PhpUnitStrictCoverageStub::createEnabled(),
90
                PhpUnitGuardCoverageStub::createEnabled('fix')
91
            ),
92
            MessagesStub::create(MessageStub::create('ok'), MessageStub::create('fix'))
93
        );
94
    }
95
}
96