Code Duplication    Length = 18-18 lines in 2 locations

src/Zicht/Itertools/itertools.php 2 locations

@@ 346-363 (lines=18) @@
343
 * @param array|string|\Iterator $iterable Additional $iterable parameters may follow
344
 * @return MapIterator
345
 */
346
function map($strategy, $iterable)
347
{
348
    // note, once we stop supporting php 5.5, we can rewrite the code below
349
    // to the map(...$iterables) structure.
350
    // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list
351
352
    if (func_num_args() > 2) {
353
        $iterables = array_slice(func_get_args(), 2);
354
    } else {
355
        $iterables = [];
356
    }
357
358
    if (!($iterable instanceof ChainInterface)) {
359
        $iterable = iterable($iterable);
360
    }
361
362
    return call_user_func_array([$iterable, 'map'], array_merge([$strategy], $iterables));
363
}
364
365
/**
366
 * Select values from the iterator by applying a function to each of the iterator values, i.e., mapping it to the
@@ 621-638 (lines=18) @@
618
 * @param array|string|\Iterator $iterable Additional $iterable parameters may follow
619
 * @return ZipIterator
620
 */
621
function zip($iterable)
622
{
623
    // note, once we stop supporting php 5.5, we can rewrite the code below
624
    // to the zip(...$iterables) structure.
625
    // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list
626
627
    if (func_num_args() > 1) {
628
        $iterables = array_slice(func_get_args(), 1);
629
    } else {
630
        $iterables = [];
631
    }
632
633
    if (!($iterable instanceof ZipInterface)) {
634
        $iterable = iterable($iterable);
635
    }
636
637
    return call_user_func_array([$iterable, 'zip'], $iterables);
638
}
639
640
/**
641
 * Returns an iterable with all the elements from $iterable reversed