ArrayTrait   A
last analyzed

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
use Closure;
6
trait ArrayTrait {
7
    protected function makeArrayWithKeys(array $array, Closure $idFunc) {
8
        $result = [ ];
9
10
        foreach($array as $item) {
11
            $result[$idFunc($item)] = $item;
12
        }
13
14
        return $result;
15
    }
16
}