Code Duplication    Length = 11-11 lines in 2 locations

src/list.php 2 locations

@@ 552-562 (lines=11) @@
549
 * @param  array $list
550
 * @return array
551
 */
552
function takeWhile() {
553
    static $takeWhile = false;
554
    $takeWhile = $takeWhile ?: curry(function($predicate, $list) {
555
        $first = head($list);
556
        return (null == $first || !$predicate($first))
557
            ? []
558
            : prepend($first, takeWhile($predicate, tail($list)));
559
560
    });
561
    return _apply($takeWhile, func_get_args());
562
}
563
564
/**
565
 * Same as `takeWhile` but taking elements from the end of the array.
@@ 579-589 (lines=11) @@
576
 * @param  array $list
577
 * @return array
578
 */
579
function takeLastWhile() {
580
    static $takeLastWhile = false;
581
    $takeLastWhile = $takeLastWhile ?: curry(function($predicate, $list) {
582
        $last = last($list);
583
        return (null == $last || !$predicate($last))
584
            ? []
585
            : append($last, takeLastWhile($predicate, init($list)));
586
587
    });
588
    return _apply($takeLastWhile, func_get_args());
589
}
590
591
/**
592
 * Takes elements from an array **until** the predicate