Completed
Push — develop ( b8005e...fd13fe )
by Freddie
03:18
created

array_key_first()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 9
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
1
<?php
2
3
// Only available for php >= 7.3
4
if (!function_exists('array_key_first')) {
5
    function array_key_first(array $arr)
6
    {
7 48
        foreach ($arr as $key => $unused) {
8 48
            unset($unused);
9
10 48
            return $key;
11
        }
12
13
        return null;
14
    }
15
}
16