Code Duplication    Length = 14-14 lines in 2 locations

src/Zicht/Itertools/itertools.php 2 locations

@@ 512-525 (lines=14) @@
509
    // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list
510
511
    $args = func_get_args();
512
    switch (sizeof($args)) {
513
        case 1:
514
            $strategy = null;
515
            $iterable = $args[0];
516
            break;
517
518
        case 2:
519
            $strategy = $args[0];
520
            $iterable = $args[1];
521
            break;
522
523
        default:
524
            throw new \InvalidArgumentException('filter requires either one (iterable) or two (strategy, iterable) arguments');
525
    }
526
527
    $strategy = conversions\mixed_to_value_getter($strategy);
528
    $isValid = function ($value, $key) use ($strategy) {
@@ 652-665 (lines=14) @@
649
function unique()
650
{
651
    $args = func_get_args();
652
    switch (sizeof($args)) {
653
        case 1:
654
            $strategy = null;
655
            $iterable = $args[0];
656
            break;
657
658
        case 2:
659
            $strategy = $args[0];
660
            $iterable = $args[1];
661
            break;
662
663
        default:
664
            throw new \InvalidArgumentException('unique requires either one (iterable) or two (strategy, iterable) arguments');
665
    }
666
667
    return new UniqueIterator(
668
        conversions\mixed_to_value_getter($strategy),