Passed
Push — master ( de4ed9...5f6eee )
by Petr
10:41
created

TKV   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
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 13
rs 10
ccs 5
cts 5
cp 1
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A keysValues() 0 7 2
1
<?php
2
3
namespace kalanis\kw_input\Traits;
4
5
6
use kalanis\kw_input\Entries\Entry;
7
use kalanis\kw_input\Interfaces;
8
9
10
/**
11
 * Trait TKV
12
 * @package kalanis\kw_input\Traits
13
 * Keys-values pairs from inputs
14
 */
15
trait TKV
16
{
17
    /**
18
     * @param Interfaces\IEntry[] $entries
19
     * @return array<string, Interfaces\IEntry>
20
     */
21 12
    protected function keysValues(array $entries): array
22
    {
23 12
        $results = [];
24 12
        foreach ($entries as &$entry) {
25 12
            $results[strval($entry->getKey())] = $entry;
26
        }
27 12
        return $results;
28
    }
29
}
30