last.php ➔ last()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 10
ccs 5
cts 5
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 last = __NAMESPACE__.'\last';
8
9
use Prelude\Exception\EmptyListException;
10
11
function last(array $xss)
12
{
13 2
    if ([] === $xss) {
14 1
        throw new EmptyListException;
15
    }
16
17 1
    return \array_values(
18 1
        \array_slice($xss, -1)
19 1
    )[0];
20
}
21