Completed
Push — master ( 61c19f...f7d981 )
by Peter
03:44
created

CompareBuildValuesEnumBench   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 37
loc 37
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A benchReflectionEnum() 4 4 1
A benchReflectionEnumNoMagic() 4 4 1
A benchExplicitEnum() 4 4 1
A benchMyCLabsEnum() 4 4 1
A benchMabeEnum() 4 4 1
A benchMabeNoMagicEnum() 4 4 1
A benchHappyTypesEnum() 4 4 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
/**
4
 * GpsLab component.
5
 *
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2017, Peter Gribanov
8
 * @license   http://opensource.org/licenses/MIT
9
 */
10
11
namespace GpsLab\Component\Enum\Bench\Compare\Operation;
12
13
use GpsLab\Component\Enum\Bench\Compare\CompareEnumBench;
14
use GpsLab\Component\Enum\Tests\Fixture\Enum\AbcExp;
15
use GpsLab\Component\Enum\Tests\Fixture\Enum\AbcRef;
16
use GpsLab\Component\Enum\Tests\Fixture\Enum\DefRef;
17
use GpsLab\Component\Enum\Tests\Fixture\Enum\Rival\AbcHappyTypes;
18
use GpsLab\Component\Enum\Tests\Fixture\Enum\Rival\AbcMarcMabe;
19
use GpsLab\Component\Enum\Tests\Fixture\Enum\Rival\AbcMyClabs;
20
use GpsLab\Component\Enum\Tests\Fixture\Enum\Rival\DefMarcMabe;
21
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
22
use PhpBench\Benchmark\Metadata\Annotations\Revs;
23
24
/**
25
 * @Revs(2500)
26
 * @Iterations(25)
27
 */
28 View Code Duplication
class CompareBuildValuesEnumBench implements CompareEnumBench
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...
29
{
30
    public function benchReflectionEnum()
31
    {
32
        AbcRef::values();
33
    }
34
35
    public function benchReflectionEnumNoMagic()
36
    {
37
        DefRef::values();
38
    }
39
40
    public function benchExplicitEnum()
41
    {
42
        AbcExp::values();
43
    }
44
45
    public function benchMyCLabsEnum()
46
    {
47
        AbcMyClabs::values();
48
    }
49
50
    public function benchMabeEnum()
51
    {
52
        AbcMarcMabe::values();
53
    }
54
55
    public function benchMabeNoMagicEnum()
56
    {
57
        DefMarcMabe::values();
58
    }
59
60
    public function benchHappyTypesEnum()
61
    {
62
        AbcHappyTypes::values();
63
    }
64
}
65