Completed
Push — master ( 8857af...ec0102 )
by Sérgio
04:30
created

each.php ➔ Sergiors\Functional\each()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 11
ccs 5
cts 5
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
 * @return mixed
9
 */
10
function each()
11
{
12 2
    $args = func_get_args();
13
14
    $each = function (\Closure $fn, array $ls) {
15 2
        array_walk($ls, $fn);
16 2
        return $ls;
17 2
    };
18
19 2
    return call_user_func_array(curry($each), $args);
20
}
21