PhpUnitGuardCoverageStub::createEnabled()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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\Message;
7
use PhpGitHooks\Module\Configuration\Domain\PhpUnitGuardCoverage;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
use PhpGitHooks\Module\Tests\Infrastructure\Stub\RandomStubInterface;
10
11 View Code Duplication
class PhpUnitGuardCoverageStub implements RandomStubInterface
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
    /**
14
     * @param Undefined $undefined
15
     * @param Enabled   $enabled
16
     * @param Message   $warningMessage
17
     *
18
     * @return PhpUnitGuardCoverage
19
     */
20
    public static function create(Undefined $undefined, Enabled $enabled, Message $warningMessage)
21
    {
22
        return new PhpUnitGuardCoverage($undefined, $enabled, $warningMessage);
23
    }
24
25
    /**
26
     * @return PhpUnitGuardCoverage
27
     */
28
    public static function random()
29
    {
30
        return self::create(
31
            new Undefined(false),
32
            EnabledStub::random(),
33
            MessageStub::random()
34
        );
35
    }
36
37
    /**
38
     * @param string|null $message
39
     * @return PhpUnitGuardCoverage
40
     */
41
    public static function createEnabled($message = null)
42
    {
43
        return self::create(
44
            new Undefined(false),
45
            EnabledStub::create(true),
46
            MessageStub::create($message)
47
        );
48
    }
49
50
    /**
51
     * @return PhpUnitGuardCoverage
52
     */
53
    public static function setUndefined()
54
    {
55
        return self::create(
56
            new Undefined(true),
57
            EnabledStub::create(false),
58
            MessageStub::create(null)
59
        );
60
    }
61
}
62