Code Duplication    Length = 18-18 lines in 2 locations

src/Zicht/Itertools/itertools.php 2 locations

@@ 356-373 (lines=18) @@
353
 * @param array|string|\Iterator $iterable Additional $iterable parameters may follow
354
 * @return MapIterator
355
 */
356
function map($strategy, $iterable)
357
{
358
    // note, once we stop supporting php 5.5, we can rewrite the code below
359
    // to the map(...$iterables) structure.
360
    // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list
361
362
    if (func_num_args() > 2) {
363
        $iterables = array_slice(func_get_args(), 2);
364
    } else {
365
        $iterables = [];
366
    }
367
368
    if (!($iterable instanceof ChainInterface)) {
369
        $iterable = iterable($iterable);
370
    }
371
372
    return call_user_func_array([$iterable, 'map'], array_merge([$strategy], $iterables));
373
}
374
375
/**
376
 * Select values from the iterator by applying a function to each of the iterator values, i.e., mapping it to the
@@ 631-648 (lines=18) @@
628
 * @param array|string|\Iterator $iterable Additional $iterable parameters may follow
629
 * @return ZipIterator
630
 */
631
function zip($iterable)
632
{
633
    // note, once we stop supporting php 5.5, we can rewrite the code below
634
    // to the zip(...$iterables) structure.
635
    // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list
636
637
    if (func_num_args() > 1) {
638
        $iterables = array_slice(func_get_args(), 1);
639
    } else {
640
        $iterables = [];
641
    }
642
643
    if (!($iterable instanceof ZipInterface)) {
644
        $iterable = iterable($iterable);
645
    }
646
647
    return call_user_func_array([$iterable, 'zip'], $iterables);
648
}
649
650
/**
651
 * Returns an iterable with all the elements from $iterable reversed