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

SequenceBench::benchFilter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 1
b 0
f 1
1
<?php
2
declare(strict_types = 1);
3
4
use Innmind\Immutable\Sequence;
5
6
final class SequenceBench
7
{
8
    private $data;
9
    private $sequence;
10
11
    public function __construct()
12
    {
13
        $this->data = unserialize(file_get_contents(__DIR__.'/fixtures.data'));
14
        $this->sequence = new Sequence(...$this->data);
15
    }
16
17
    public function benchNamedConstructor()
18
    {
19
        Sequence::of(...$this->data);
20
    }
21
22
    public function benchMap()
23
    {
24
        $this->sequence->map(static function(int $i): int {
25
            return $i ** 2;
26
        });
27
    }
28
29
    public function benchGet()
30
    {
31
        $this->sequence->get(500);
32
    }
33
34
    public function benchHas()
35
    {
36
        $this->sequence->has(500);
37
    }
38
39
    public function benchIndexOf()
40
    {
41
        $this->sequence->indexOf(500);
42
    }
43
44
    public function benchDistinct()
45
    {
46
        $this->sequence->indexOf(500);
47
    }
48
49
    public function benchDiff()
50
    {
51
        $this->sequence->diff($this->sequence);
52
    }
53
54
    public function benchAppend()
55
    {
56
        $this->sequence->append($this->sequence);
57
    }
58
59
    public function benchContains()
60
    {
61
        $this->sequence->contains(500);
62
    }
63
64
    public function benchDrop()
65
    {
66
        $this->sequence->drop(500);
67
    }
68
69
    public function benchDropEnd()
70
    {
71
        $this->sequence->dropEnd(500);
72
    }
73
74
    public function benchEquals()
75
    {
76
        $this->sequence->equals($this->sequence);
77
    }
78
79
    public function benchFilter()
80
    {
81
        $this->sequence->filter(static function(int $i): bool {
82
            return $i % 2 === 0;
83
        });
84
    }
85
86
    public function benchForeach()
87
    {
88
        $this->sequence->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

88
        $this->sequence->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...
89
            // pass
90
        });
91
    }
92
93
    public function benchGroupBy()
94
    {
95
        $this->sequence->groupBy(static function(int $i): int {
96
            return $i % 2;
97
        });
98
    }
99
100
    public function benchFirst()
101
    {
102
        $this->sequence->first();
103
    }
104
105
    public function benchLast()
106
    {
107
        $this->sequence->last();
108
    }
109
110
    public function benchIndices()
111
    {
112
        $this->sequence->indices();
113
    }
114
115
    public function benchTake()
116
    {
117
        $this->sequence->take(500);
118
    }
119
120
    public function benchTakeEnd()
121
    {
122
        $this->sequence->takeEnd(500);
123
    }
124
125
    public function benchIntersect()
126
    {
127
        $this->sequence->intersect($this->sequence);
128
    }
129
130
    public function benchSort()
131
    {
132
        $this->sequence->sort(static function(): int {
133
            return -1;
134
        });
135
    }
136
137
    public function benchReduce()
138
    {
139
        $this->sequence->reduce(
140
            0,
141
            static function(int $sum, int $i): int {
142
                return $sum + $i;
143
            }
144
        );
145
    }
146
147
    public function benchReverse()
148
    {
149
        $this->sequence->reverse();
150
    }
151
}
152