expand()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt;
5
6
/**
7
 * @param array $items
8
 * @param string $separator
9
 * @return array
10
 */
11
function expand(array $items, string $separator = '.'): array
12
{
13
    $result = [];
14
    foreach ($items as $key => $value) {
15
        set_path($result, (string) $key, $value, $separator);
16
    }
17
18
    return $result;
19
}
20