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

MabeEnumBench::benchCompareDifferent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Segregate;
12
13
use GpsLab\Component\Enum\Tests\Fixture\Enum\Rival\AbcMarcMabe;
14
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
15
use PhpBench\Benchmark\Metadata\Annotations\Revs;
16
17
/**
18
 * @Revs(2500)
19
 * @Iterations(25)
20
 */
21 View Code Duplication
class MabeEnumBench implements SegregateEnumBench
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...
22
{
23
    public function benchInit()
24
    {
25
        $a = AbcMarcMabe::A();
0 ignored issues
show
Unused Code introduced by
$a is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
26
    }
27
28
    public function benchCompareSelf()
29
    {
30
        $a = AbcMarcMabe::A();
31
        $a->is(AbcMarcMabe::A());
32
    }
33
34
    public function benchInitTwice()
35
    {
36
        $a = AbcMarcMabe::A();
0 ignored issues
show
Unused Code introduced by
$a is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
37
        $z = AbcMarcMabe::A();
0 ignored issues
show
Unused Code introduced by
$z is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
38
    }
39
40
    public function benchInitTwiceDifferentValue()
41
    {
42
        $a = AbcMarcMabe::A();
0 ignored issues
show
Unused Code introduced by
$a is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
43
        $b = AbcMarcMabe::B();
0 ignored issues
show
Unused Code introduced by
$b is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
44
    }
45
46
    public function benchCompareDifferent()
47
    {
48
        AbcMarcMabe::A()->is(AbcMarcMabe::B());
49
    }
50
51
    public function benchToString()
52
    {
53
        $c = (string) AbcMarcMabe::C();
0 ignored issues
show
Unused Code introduced by
$c is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
54
    }
55
56
    public function benchBuildChoices()
57
    {
58
        AbcMarcMabe::choices();
59
    }
60
61
    public function benchBuildValues()
62
    {
63
        AbcMarcMabe::values();
64
    }
65
}
66