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

MapPrimitiveBench::benchPartition()   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 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
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 {
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;
108
            }
109
        );
110
    }
111
}
112