Code Duplication    Length = 8-8 lines in 2 locations

src/Zicht/Itertools/itertools.php 2 locations

@@ 603-610 (lines=8) @@
600
601
    $args = func_get_args();
602
    switch (sizeof($args)) {
603
        case 2:
604
            $strategy = Conversions::mixedToValueGetter($args[0]);
605
            $closure = function ($value, $key) use ($strategy) {
606
                $tempVarPhp54 = call_user_func($strategy, $value, $key);
607
                return !empty($tempVarPhp54);
608
            };
609
            $iterable = Conversions::mixedToIterator($args[1]);
610
            break;
611
612
        case 3:
613
            $strategy = Conversions::mixedToValueGetter($args[0]);
@@ 612-619 (lines=8) @@
609
            $iterable = Conversions::mixedToIterator($args[1]);
610
            break;
611
612
        case 3:
613
            $strategy = Conversions::mixedToValueGetter($args[0]);
614
            $userClosure = $args[1];
615
            $closure = function ($value, $key) use ($strategy, $userClosure) {
616
                return call_user_func($userClosure, call_user_func($strategy, $value, $key));
617
            };
618
            $iterable = Conversions::mixedToIterator($args[2]);
619
            break;
620
621
        default:
622
            throw new \InvalidArgumentException('filterBy requires either two (strategy, iterable) or three (strategy, closure, iterable) arguments');