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 ( 0a055b...d2cbc8 )
by Anton
04:46
created

Config::merge()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 12
nc 5
nop 2
dl 0
loc 22
rs 8.6737
c 0
b 0
f 0
1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Type;
9
10
/**
11
 * Class Config
12
 * @package Deployer\Type
13
 */
14
class Config
15
{
16
    /**
17
     * Recursively merge two config arrays with a specific behavior:
18
     *
19
     * 1. scalar values are overridden
20
     * 2. array values are extended uniquely if all keys are numeric
21
     * 3. all other array values are merged
22
     *
23
     * @param array $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
24
     * @param array $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
25
     * @return array
26
     * @see http://stackoverflow.com/a/36366886/6812729
27
     */
28
    public static function merge(array $original, array $override)
29
    {
30
        foreach ($override as $key => $value) {
31
            if (isset($original[$key])) {
32
                if (!is_array($original[$key])) {
33
                    // Override scalar value
34
                    $original[$key] = $value;
35
                } elseif (array_keys($original[$key]) === range(0, count($original[$key]) - 1)) {
36
                    // Uniquely append to array with numeric keys
37
                    $original[$key] = array_unique(array_merge($original[$key], $value));
38
                } else {
39
                    // Merge all other arrays
40
                    $original[$key] = Config::merge($original[$key], $value);
41
                }
42
            } else {
43
                // Simply add new key/value
44
                $original[$key] = $value;
45
            }
46
        }
47
48
        return $original;
49
    }
50
}
51