Arr   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

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