Completed
Push — master ( f92548...5447f3 )
by Marcel
03:46
created

ArrayTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A makeArrayWithKeys() 0 8 2
1
<?php
2
3
namespace App\Traits;
4
5
trait ArrayTrait {
6
    protected function makeArrayWithKeys(array $array, \Closure $idFunc) {
7
        $result = [ ];
8
9
        foreach($array as $item) {
10
            $result[$idFunc($item)] = $item;
11
        }
12
13
        return $result;
14
    }
15
}