PhpCsFixerLevelsStub   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 36
loc 36
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 4 4 1
A random() 4 4 1
A createEnabled() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Tests\Stub;
4
5
use PhpGitHooks\Module\Configuration\Domain\Level;
6
use PhpGitHooks\Module\Configuration\Domain\PhpCsFixerLevels;
7
use PhpGitHooks\Module\Tests\Infrastructure\Stub\RandomStubInterface;
8
9 View Code Duplication
class PhpCsFixerLevelsStub 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...
10
{
11
    /**
12
     * @param Level $psr0
13
     * @param Level $psr1
14
     * @param Level $psr2
15
     * @param Level $symfony
16
     *
17
     * @return PhpCsFixerLevels
18
     */
19
    public static function create(Level $psr0, Level $psr1, Level $psr2, Level $symfony)
20
    {
21
        return new PhpCsFixerLevels($psr0, $psr1, $psr2, $symfony);
22
    }
23
24
    /**
25
     * @return PhpCsFixerLevels
26
     */
27
    public static function random()
28
    {
29
        return self::create(LevelStub::random(), LevelStub::random(), LevelStub::random(), LevelStub::random());
30
    }
31
32
    /**
33
     * @return PhpCsFixerLevels
34
     */
35
    public static function createEnabled()
36
    {
37
        return self::create(
38
            LevelStub::create(true),
39
            LevelStub::create(true),
40
            LevelStub::create(true),
41
            LevelStub::create(true)
42
        );
43
    }
44
}
45