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.

Helper   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 24
ccs 8
cts 9
cp 0.8889
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A array_intersect_recursive() 0 14 5
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 2
    public static function array_intersect_recursive($array1, $array2)
25
    {
26 2
        foreach($array1 as $key => $value) {
27 2
            if (!isset($array2[$key])) {
28
                unset($array1[$key]);
29
            } else {
30 2
                if (is_array($array1[$key])) {
31 1
                    $array1[$key] = self::array_intersect_recursive($array1[$key], $array2[$key]);
32 2
                } elseif ($array2[$key] !== $value) {
33 2
                    unset($array1[$key]);
34
                }
35
            }
36
        }
37 2
        return $array1;
38
    }
39
}