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 Failed
Push — master ( 659f53...df9043 )
by Peng
03:26
created

Helper::array_intersect_recursive()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 9
nc 5
nop 2
dl 0
loc 14
rs 8.8571
c 1
b 0
f 0
1
<?php
2
3
namespace Awin\ReportTask\Bundle\ReportBundle\Utility;
4
5
/**
6
 * Quick utility class for the static method usuage
7
 *
8
 * @date       25/06/2017
9
 * @time       22:19
10
 * @author     Peng Yue <[email protected]>
11
 * @copyright  2004-2017 Peng Yue
12
 */
13
14
class Helper
15
{
16
    /**
17
     * recursively intersect arrays
18
     *
19
     * @param array $array1
20
     * @param array $array2
21
     *
22
     * @return array
23
     */
24
    public static function array_intersect_recursive($array1, $array2)
25
    {
26
        foreach($array1 as $key => $value) {
27
            if (!isset($array2[$key])) {
28
                unset($array1[$key]);
29
            } else {
30
                if (is_array($array1[$key])) {
31
                    $array1[$key] = self::array_intersect_recursive($array1[$key], $array2[$key]);
32
                } elseif ($array2[$key] !== $value) {
33
                    unset($array1[$key]);
34
                }
35
            }
36
        }
37
        return $array1;
38
    }
39
}