PhpUnitStub::random()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Tests\Stub;
4
5
use PhpGitHooks\Module\Configuration\Domain\Enabled;
6
use PhpGitHooks\Module\Configuration\Domain\PhpUnit;
7
use PhpGitHooks\Module\Configuration\Domain\PhpUnitOptions;
8
use PhpGitHooks\Module\Configuration\Domain\PhpUnitRandomMode;
9
use PhpGitHooks\Module\Configuration\Domain\Undefined;
10
use PhpGitHooks\Module\Tests\Infrastructure\Stub\RandomStubInterface;
11
12
class PhpUnitStub implements RandomStubInterface
13
{
14
    /**
15
     * @param Undefined         $undefined
16
     * @param Enabled           $enabled
17
     * @param PhpUnitRandomMode $randomMode
18
     * @param PhpUnitOptions    $options
19
     *
20
     * @return PhpUnit
21
     */
22
    public static function create(
23
        Undefined $undefined,
24
        Enabled $enabled,
25
        PhpUnitRandomMode $randomMode,
26
        PhpUnitOptions $options
27
    ) {
28
        return new PhpUnit($undefined, $enabled, $randomMode, $options);
29
    }
30
31
    /**
32
     * @return PhpUnit
33
     */
34
    public static function random()
35
    {
36
        return self::create(
37
            new Undefined(false),
38
            EnabledStub::random(),
39
            PhpUnitRandomModeStub::random(),
40
            PhpUnitOptionsStub::random()
41
        );
42
    }
43
44
    /**
45
     * @param string $options
46
     *
47
     * @return PhpUnit
48
     */
49 View Code Duplication
    public static function createEnabled($options = '--testsuite default')
0 ignored issues
show
Duplication introduced by
This method 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...
50
    {
51
        return self::create(
52
            new Undefined(false),
53
            EnabledStub::create(true),
54
            PhpUnitRandomModeStub::create(true),
55
            PhpUnitOptionsStub::create($options)
56
        );
57
    }
58
59
    /**
60
     * @return PhpUnit
61
     */
62 View Code Duplication
    public static function setUndefined()
0 ignored issues
show
Duplication introduced by
This method 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...
63
    {
64
        return self::create(
65
            new Undefined(true),
66
            EnabledStub::create(false),
67
            PhpUnitRandomModeStub::create(false),
68
            PhpUnitOptionsStub::create(null)
69
        );
70
    }
71
}
72