Arrays   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 21
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B mergeRecursiveUnique() 0 18 5
1
<?php
2
namespace DICIT\Util;
3
4
class Arrays
5
{
6
    public static function mergeRecursiveUnique (array $array1, array $array2)
7
    {
8
        $merged = $array1;
9
10
        foreach ($array2 as $key => $value)
11
        {
12
            if (is_array($value) && isset($merged[$key]) && is_array($merged [$key]))
13
            {
14
                $merged[$key] = self::mergeRecursiveUnique($merged[$key], $value);
15
            }
16
            else
17
            {
18
                $merged[$key] = $value;
19
            }
20
        }
21
22
        return $merged;
23
    }
24
}
25