deleteat.php ➔ deleteat()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 7
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 14
ccs 5
cts 6
cp 0.8333
crap 2.0185
rs 9.4285
1
<?php
2
3
namespace Sergiors\Functional;
4
5
const deleteat = '\Sergiors\Functional\deleteat';
6
7
function deleteat(/* ...$args */)
8
{
9 1
    $args = func_get_args();
10
11
    $deleteat = function ($n, array $xs) {
12 1
        if ($n > 0) {
13 1
            return array_merge(take($n, $xs), drop($n + 1, $xs));
14
        }
15
16
        return $xs;
17 1
    };
18
19 1
    return call_user_func_array(partial($deleteat), $args);
20
}
21