ArrayDiff   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDiff() 0 13 3
1
<?php
2
3
namespace DrLenux\ArraySmartDiff;
4
5
/**
6
 * Class ArrayDiff
7
 * @package DrLenux\ArraySmartDiff
8
 */
9
class ArrayDiff
10
{
11
    /**
12
     * @param array ...$array
13
     * @return array
14
     */
15
    public static function getDiff(array ...$array)
16
    {
17
        $old = array_diff_assoc(...$array);
18
        $new = array_diff_assoc(...(array_reverse($array)));
19
20
        $res = [];
21
        foreach ($new as $v => $k) {
22
            $res[$v]['new'] = $k;
23
        }
24
        foreach ($old as $v => $k) {
25
            $res[$v]['old'] = $k;
26
        }
27
        return $res;
28
    }
29
}