GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 579460...fd060d )
by Baptiste
04:45 queued 10s
created

SetBench   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 24
c 1
b 0
f 1
dl 0
loc 87
ccs 0
cts 62
cp 0
rs 10
wmc 14
1
<?php
2
declare(strict_types = 1);
3
4
use Innmind\Immutable\Set;
5
6
final class SetBench
7
{
8
    private $data;
9
    private $set;
10
11
    public function __construct()
12
    {
13
        $this->data = unserialize(file_get_contents(__DIR__.'/fixtures.data'));
14
        $this->set = Set::of('int', ...$this->data);
15
    }
16
17
    public function benchNamedConstructor()
18
    {
19
        Set::of('int', ...$this->data);
20
    }
21
22
    public function benchIntersect()
23
    {
24
        $this->set->intersect($this->set);
25
    }
26
27
    public function benchContains()
28
    {
29
        $this->set->contains(500);
30
    }
31
32
    public function benchRemove()
33
    {
34
        $this->set->remove(500);
35
    }
36
37
    public function benchDiff()
38
    {
39
        $this->set->diff($this->set);
40
    }
41
42
    public function benchEquals()
43
    {
44
        $this->set->equals($this->set);
45
    }
46
47
    public function benchFilter()
48
    {
49
        $this->set->filter(static function(int $i): bool {
50
            return $i % 2 === 0;
51
        });
52
    }
53
54
    public function benchForeach()
55
    {
56
        $this->set->foreach(static function(int $i): void {
57
            // pass
58
        });
59
    }
60
61
    public function benchGroupBy()
62
    {
63
        $this->set->groupBy(static function(int $i): int {
64
            return $i % 2;
65
        });
66
    }
67
68
    public function benchMap()
69
    {
70
        $this->set->map(static function(int $i): int {
71
            return $i ** 2;
72
        });
73
    }
74
75
    public function benchPartition()
76
    {
77
        $this->set->partition(static function(int $i): bool {
78
            return $i % 2 === 0;
79
        });
80
    }
81
82
    public function benchMerge()
83
    {
84
        $this->set->merge($this->set);
85
    }
86
87
    public function benchReduce()
88
    {
89
        $this->set->reduce(
90
            0,
91
            static function(int $sum, int $i): int {
92
                return $sum + $i;
93
            }
94
        );
95
    }
96
}
97