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.
Passed
Push — master ( 5205fe...5906b8 )
by Baptiste
03:02
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
dl 0
loc 87
ccs 0
cts 68
cp 0
rs 10
c 1
b 0
f 1
wmc 14

14 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A benchForeach() 0 3 1
A benchIntersect() 0 3 1
A benchDiff() 0 3 1
A benchFilter() 0 4 1
A benchGroupBy() 0 4 1
A benchNamedConstructor() 0 3 1
A benchReduce() 0 6 1
A benchEquals() 0 3 1
A benchContains() 0 3 1
A benchMerge() 0 3 1
A benchMap() 0 4 1
A benchRemove() 0 3 1
A benchPartition() 0 4 1
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 {
0 ignored issues
show
Unused Code introduced by
The parameter $i is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

56
        $this->set->foreach(static function(/** @scrutinizer ignore-unused */ int $i): void {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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