Test Setup Failed
Push — master ( 4174a9...0ddee3 )
by Sérgio
03:32
created

last.php ➔ last()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 10
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
function last(array $xss)
10
{
11
    if ([] === $xss) {
12
        throw new \InvalidArgumentException;
13
    }
14
15
    return array_values(
16
        array_slice($xss, -1)
17
    )[0];
18
}
19