IntersectKey::intersectKey()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Cocur\Chain\Link;
4
5
use Cocur\Chain\Chain;
6
7
/**
8
 * IntersectKey.
9
 *
10
 * @author    Florian Eckerstorfer
11
 * @copyright 2015-2018 Florian Eckerstorfer
12
 */
13
trait IntersectKey
14
{
15
    /**
16
     * @param Chain|array $array
17
     *
18
     * @return self
19
     */
20 2
    public function intersectKey($array): self
21
    {
22 2
        $this->array = array_intersect_key($this->array, $array instanceof Chain ? $array->array : $array);
23
24 2
        return $this;
25
    }
26
}
27