Completed
Push — master ( 1316f3...b7872d )
by Aydin
26s queued 12s
created

ArrayUtil   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A mapWithKeys() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpSchool\CliMenu\Util;
6
7
class ArrayUtil
8
{
9
    public static function mapWithKeys(array $array, callable $callback) : array
10
    {
11
        return array_combine(
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_combine(arr..._keys($array), $array)) could return the type false which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
12
            array_keys($array),
13
            array_map($callback, array_keys($array), $array)
14
        );
15
    }
16
}
17