Code Duplication    Length = 10-11 lines in 4 locations

src/drop.php 1 location

@@ 12-21 (lines=10) @@
9
 *
10
 * @return mixed
11
 */
12
function drop(/* ...$args */)
13
{
14
    $args = func_get_args();
15
16
    $drop = function ($n, array $xs) {
17
        return array_slice($xs, $n);
18
    };
19
20
    return call_user_func_array(partial($drop), $args);
21
}
22

src/each.php 1 location

@@ 12-22 (lines=11) @@
9
 *
10
 * @return mixed
11
 */
12
function each(/* ...$args */)
13
{
14
    $args = func_get_args();
15
16
    $each = function (callable $fn, array $xs) {
17
        array_walk($xs, $fn);
18
        return $xs;
19
    };
20
21
    return call_user_func_array(partial($each), $args);
22
}
23

src/prepend.php 1 location

@@ 12-21 (lines=10) @@
9
 *
10
 * @return mixed
11
 */
12
function prepend(/* ...$args */)
13
{
14
    $args = func_get_args();
15
16
    $prepend = function ($x, array $xs) {
17
        return array_merge([$x], $xs);
18
    };
19
20
    return call_user_func_array(partial($prepend), $args);
21
}
22

src/take.php 1 location

@@ 12-21 (lines=10) @@
9
 *
10
 * @return mixed
11
 */
12
function take(/* ...$args */)
13
{
14
    $args = func_get_args();
15
16
    $take = function ($n, array $xs) {
17
        return array_slice($xs, 0, $n);
18
    };
19
20
    return call_user_func_array(partial($take), $args);
21
}
22