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.
Test Setup Failed
Pull Request — master (#162)
by Yong
03:00
created

Arrays::merge()   A

Complexity

Conditions 6
Paths 5

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

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