Combine   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A combine() 0 8 3
1
<?php
2
3
namespace Cocur\Chain\Link;
4
5
use Cocur\Chain\Chain;
6
7
/**
8
 * Class ChangeKeyCase.
9
 *
10
 * @author      Christoph Rosse
11
 */
12
trait Combine
13
{
14
    /**
15
     * Creates an Chain by using one Chain for keys and another for its values.
16
     *
17
     * @param Chain|array $keys   Array or instance of `Cocur\Chain\Chain` of keys to be used. Illegal values for key
18
     *                            will be converted to string.
19
     * @param Chain|array $values array or instance of `Cocur\Chain\Chain` of values to be used
20
     *
21
     * @return self
22
     */
23 2
    public function combine($keys, $values): self
24
    {
25 2
        $this->array = array_combine(
26 2
            $keys instanceof Chain ? $keys->array : $keys,
27 2
            $values instanceof Chain ? $values->array : $values
28
        );
29
30 2
        return $this;
31
    }
32
}
33