Passed
Push — sequential-generator ( f17b30...95f572 )
by Marcel
03:19
created

GeneratorBench   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 48
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A benchVersion1Generator() 0 3 1
A benchVersion5Generator() 0 3 1
A benchVersion4Generator() 0 3 1
A benchCombGenerator() 0 3 1
A __construct() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
use UMA\Uuid\Uuid;
6
use UMA\Uuid\CombGenerator;
7
use UMA\Uuid\Version1Generator;
8
use UMA\Uuid\Version4Generator;
9
use UMA\Uuid\Version5Generator;
10
11
/**
12
 * @Revs(100000)
13
 * @Iterations(10)
14
 */
15
class GeneratorBench
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
{
17
    /**
18
     * @var CombGenerator
19
     */
20
    private $comb;
21
22
    /**
23
     * @var Version1Generator
24
     */
25
    private $v1;
26
27
    /**
28
     * @var Version4Generator
29
     */
30
    private $v4;
31
32
    /**
33
     * @var Version5Generator
34
     */
35
    private $v5;
36
37
    public function __construct()
38
    {
39
        $this->comb = new CombGenerator;
40
        $this->v1 = new Version1Generator('01:23:45:67:89:ab');
41
        $this->v4 = new Version4Generator;
42
        $this->v5 = new Version5Generator(Uuid::nil());
43
    }
44
45
    public function benchCombGenerator()
46
    {
47
        $this->comb->generate();
48
    }
49
50
    public function benchVersion1Generator()
51
    {
52
        $this->v1->generate();
53
    }
54
55
    public function benchVersion4Generator()
56
    {
57
        $this->v4->generate();
58
    }
59
60
    public function benchVersion5Generator()
61
    {
62
        $this->v5->generate('foo');
63
    }
64
}
65