Passed
Push — master ( d9423e...3d42cd )
by Lukas
04:29
created

Arr   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 12 2
1
<?php
2
3
namespace Lneicelis\Transformer\Helper;
4
5
class Arr
6
{
7 3
    public static function setValue(array $array, array $path, $value): array
8
    {
9 3
        $lastKey = array_pop($path);
10 3
        $current = &$array;
11
12 3
        foreach($path as $key) {
13 3
            $current = &$current[$key];
14
        }
15
16 3
        $current[$lastKey] = $value;
17
18 3
        return $array;
19
    }
20
}
21