head.php ➔ head()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
ccs 3
cts 3
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Prelude;
6
7
const head = __NAMESPACE__.'\head';
8
9
use Prelude\Exception\EmptyListException;
10
11
function head(array $xss)
12
{
13 4
    if ([] === $xss) {
14 1
        throw new EmptyListException;
15
    }
16
17 3
    return \array_values($xss)[0];
18
}
19