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   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 38
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A map() 0 8 1
A pull() 0 8 1
A mirror() 0 4 1
A createUniquePairs() 0 12 3
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