Completed
Push — master ( 551288...be024e )
by Sérgio
03:52
created

last.php ➔ last()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 10
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
1
<?php
2
3
namespace Sergiors\Functional;
4
5
/**
6
 * @author Sérgio Rafael Siqueira <[email protected]>
7
 */
8
function last(/* ...$args */)
9
{
10 1
    $args = func_get_args();
11
12
    $last = function ($xs) {
13 1
        return get(array_values(array_slice($xs, -1)), 0);
14 1
    };
15
16 1
    return call_user_func_array(partial($last), $args);
17
}
18