Passed
Push — master ( 2f6942...d6d802 )
by Chris
28:11
created

Intersection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A remix() 0 10 2
1
<?php
2
3
namespace WebTheory\Collection\Fusion;
4
5
use WebTheory\Collection\Contracts\ArrayFusionInterface;
6
use WebTheory\Collection\Fusion\Abstracts\AbstractArrayFusion;
7
8
class Intersection extends AbstractArrayFusion implements ArrayFusionInterface
9
{
10 21
    public function remix(array ...$collections): array
11
    {
12 21
        $fusion = array_shift($collections);
13 21
        $callback = $this->getComparisonCallback();
14
15 21
        foreach ($collections as $collection) {
16 21
            $fusion = array_uintersect($fusion, $collection, $callback);
17
        }
18
19 21
        return $fusion;
20
    }
21
}
22