Passed
Push — master ( f2fbdd...d33d35 )
by Dominik
02:49
created

array_map_keys()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
require_once __DIR__.'/../vendor/autoload.php';
6
7
if (! function_exists('array_map_keys')) {
8
    /**
9
     * @param array    $input
10
     * @param callable $callback
11
     *
12
     * @return array
13
     */
14
    function array_map_keys($input, $callback)
15
    {
16
        $output = [];
17
18
        foreach ($input as $key => $value) {
19
            $output[] = $callback($key, $value);
20
        }
21
22
        return $output;
23
    }
24
}
25