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.

Arrays::merge()   A
last analyzed

Complexity

Conditions 6
Paths 5

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 12
c 1
b 0
f 0
nc 5
nop 1
dl 0
loc 22
ccs 16
cts 16
cp 1
crap 6
rs 9.2222
1
<?php
2
3
namespace AlibabaCloud\Client\Support;
4
5
/**
6
 * Class Arrays
7
 *
8
 * @package AlibabaCloud\Client\Support
9
 */
10
class Arrays
11
{
12
13
    /**
14
     * @param array $arrays
15
     *
16
     * @return array
17
     */
18 99
    public static function merge(array $arrays)
19
    {
20 99
        $result = [];
21 99
        foreach ($arrays as $array) {
22 99
            foreach ($array as $key => $value) {
23 99
                if (is_int($key)) {
24 3
                    $result[] = $value;
25 3
                    continue;
26
                }
27
28 96
                if (isset($result[$key]) && is_array($result[$key])) {
29 1
                    $result[$key] = self::merge(
30 1
                        [$result[$key], $value]
31 1
                    );
32 1
                    continue;
33
                }
34
35 96
                $result[$key] = $value;
36 99
            }
37 99
        }
38
39 99
        return $result;
40
    }
41
}
42