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); |
|
1 ignored issue
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
23 | |||
24 | 2 | return $this; |
|
25 | } |
||
26 | } |
||
27 |