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 ( f46a23...825633 )
by Baptiste
04:48
created

MapPrimitiveBench   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 102
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 33
dl 0
loc 102
ccs 0
cts 82
cp 0
rs 10
c 1
b 0
f 0
wmc 15

15 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A benchPartition() 0 4 1
A benchReduce() 0 6 1
A benchNamedConstructor() 0 7 1
A benchEquals() 0 3 1
A benchMerge() 0 3 1
A benchForeach() 0 3 1
A benchContains() 0 3 1
A benchMap() 0 4 1
A benchRemove() 0 3 1
A benchGet() 0 3 1
A benchFilter() 0 4 1
A benchKeys() 0 3 1
A benchGroupBy() 0 4 1
A benchValues() 0 3 1
1
<?php
2
declare(strict_types = 1);
3
4
use Innmind\Immutable\Map;
5
6
final class MapPrimitiveBench
7
{
8
    private $data;
9
    private $map;
10
11
    public function __construct()
12
    {
13
        $this->data = unserialize(file_get_contents(__DIR__.'/fixtures.data'));
14
        $this->map = Map::of(
15
            'int',
16
            'int',
17
            array_keys($this->data),
18
            array_values($this->data)
19
        );
20
    }
21
22
    public function benchNamedConstructor()
23
    {
24
        Map::of(
25
            'int',
26
            'int',
27
            array_keys($this->data),
28
            array_values($this->data)
29
        );
30
    }
31
32
    public function benchGet()
33
    {
34
        $this->map->get(500);
35
    }
36
37
    public function benchContains()
38
    {
39
        $this->map->contains(500);
40
    }
41
42
    public function benchEquals()
43
    {
44
        $this->map->equals($this->map);
45
    }
46
47
    public function benchFilter()
48
    {
49
        $this->map->filter(static function(int $k, int $v): bool {
50
            return $v % 2 === 0;
51
        });
52
    }
53
54
    public function benchForeach()
55
    {
56
        $this->map->foreach(static function(int $k, int $v): void {
0 ignored issues
show
Unused Code introduced by
The parameter $v 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->map->foreach(static function(int $k, /** @scrutinizer ignore-unused */ int $v): 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...
Unused Code introduced by
The parameter $k 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->map->foreach(static function(/** @scrutinizer ignore-unused */ int $k, int $v): 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->map->groupBy(static function(int $k, int $v): int {
64
            return $v % 2;
65
        });
66
    }
67
68
    public function benchKeys()
69
    {
70
        $this->map->keys();
71
    }
72
73
    public function benchValues()
74
    {
75
        $this->map->values();
76
    }
77
78
    public function benchMap()
79
    {
80
        $this->map->map(static function(int $i): int {
81
            return $i ** 2;
82
        });
83
    }
84
85
    public function benchRemove()
86
    {
87
        $this->map->remove(500);
88
    }
89
90
    public function benchMerge()
91
    {
92
        $this->map->merge($this->map);
93
    }
94
95
    public function benchPartition()
96
    {
97
        $this->map->partition(static function(int $k, int $v): bool {
98
            return $v % 2 === 0;
99
        });
100
    }
101
102
    public function benchReduce()
103
    {
104
        $this->map->reduce(
105
            0,
106
            static function(int $sump, int $k, int $v): int {
107
                return $sum + $k + $v;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $sum does not exist. Did you maybe mean $sump?
Loading history...
108
            }
109
        );
110
    }
111
}
112