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 ( 4a0fc1...33f0fd )
by Sebastian
03:04 queued 57s
created

Arr::map()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace Spatie\OpeningHours\Helpers;
4
5
class Arr
6
{
7
    public static function map(array $array, callable $callback)
8
    {
9
        $keys = array_keys($array);
10
11
        $items = array_map($callback, $array, $keys);
12
13
        return array_combine($keys, $items);
14
    }
15
16
    public static function pull(&$array, $key, $default = null)
17
    {
18
        $value = $array[$key] ?? $default;
19
20
        unset($array[$key]);
21
22
        return $value;
23
    }
24
25
    public static function mirror(array $array)
26
    {
27
        return array_combine($array, $array);
28
    }
29
30
    public static function createUniquePairs(array $array): array
31
    {
32
        $pairs = [];
33
34
        while ($a = array_shift($array)) {
35
            foreach ($array as $b) {
36
                $pairs[] = [$a, $b];
37
            }
38
        }
39
40
        return $pairs;
41
    }
42
}
43