Code Duplication    Length = 18-18 lines in 2 locations

src/Zicht/Itertools/itertools.php 2 locations

@@ 362-379 (lines=18) @@
359
 * @return MapIterator
360
 * @deprecated Use iterable($iterable)->map($strategy, [$iterable2, ...]), will be removed in version 3.0
361
 */
362
function map($strategy, $iterable)
363
{
364
    // note, once we stop supporting php 5.5, we can rewrite the code below
365
    // to the map(...$iterables) structure.
366
    // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list
367
368
    if (func_num_args() > 2) {
369
        $iterables = array_slice(func_get_args(), 2);
370
    } else {
371
        $iterables = [];
372
    }
373
374
    if (!($iterable instanceof ChainInterface)) {
375
        $iterable = iterable($iterable);
376
    }
377
378
    return call_user_func_array([$iterable, 'map'], array_merge([$strategy], $iterables));
379
}
380
381
/**
382
 * Select values from the iterator by applying a function to each of the iterator values, i.e., mapping it to the
@@ 643-660 (lines=18) @@
640
 * @return ZipIterator
641
 * @deprecated Use iterable($iterable)->zip($iterable2, [$iterable3, ...]), will be removed in version 3.0
642
 */
643
function zip($iterable)
644
{
645
    // note, once we stop supporting php 5.5, we can rewrite the code below
646
    // to the zip(...$iterables) structure.
647
    // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list
648
649
    if (func_num_args() > 1) {
650
        $iterables = array_slice(func_get_args(), 1);
651
    } else {
652
        $iterables = [];
653
    }
654
655
    if (!($iterable instanceof ZipInterface)) {
656
        $iterable = iterable($iterable);
657
    }
658
659
    return call_user_func_array([$iterable, 'zip'], $iterables);
660
}
661
662
/**
663
 * Returns an iterable with all the elements from $iterable reversed