Completed
Branch module_structure (3116d9)
by Pablo
02:56
created

PrePushStub   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 7
dl 0
loc 59
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 1
A random() 0 9 1
A createAllEnabled() 0 9 1
A setUndefined() 0 9 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\PrePush;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
use PhpGitHooks\Module\Configuration\Model\ExecuteInterface;
10
use PhpGitHooks\Module\Tests\Infrastructure\Stub\RandomStubInterface;
11
12
class PrePushStub implements RandomStubInterface
13
{
14
    /**
15
     * @param Undefined        $undefined
16
     * @param Enabled          $enabled
17
     * @param ExecuteInterface $execute
18
     * @param Messages         $messages
19
     *
20
     * @return PrePush
21
     */
22
    public static function create(Undefined $undefined, Enabled $enabled, ExecuteInterface $execute, Messages $messages)
23
    {
24
        return new PrePush(
25
            $undefined,
26
            $enabled,
27
            $execute,
28
            $messages
29
        );
30
    }
31
32
    /**
33
     * @return PrePush
34
     */
35
    public static function random()
36
    {
37
        return self::create(
38
            new Undefined(false),
39
            EnabledStub::random(),
40
            PrePushExecuteStub::create(PhpUnitStub::random()),
41
            MessagesStub::random()
42
        );
43
    }
44
45
    /**
46
     * @return PrePush
47
     */
48
    public static function createAllEnabled()
49
    {
50
        return self::create(
51
            new Undefined(false),
52
            EnabledStub::create(true),
53
            PrePushExecuteStub::createEnabled(),
54
            MessagesStub::create(MessageStub::create('0k'), MessageStub::create('Faltal'))
55
        );
56
    }
57
58
    /**
59
     * @return PrePush
60
     */
61
    public static function setUndefined()
62
    {
63
        return self::create(
64
            new Undefined(true),
65
            EnabledStub::create(false),
66
            PrePushExecuteStub::create(PhpUnitStub::setUndefined()),
67
            MessagesStub::random()
68
        );
69
    }
70
}
71