GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 14-17 lines in 3 locations

src/collection_functions.php 3 locations

@@ 824-840 (lines=17) @@
821
 * @param callable $function ($value, $key)
822
 * @return Collection
823
 */
824
function dropWhile($collection, callable $function)
825
{
826
    $generatorFactory = function () use ($collection, $function) {
827
        $shouldDrop = true;
828
        foreach ($collection as $key => $value) {
829
            if ($shouldDrop) {
830
                $shouldDrop = $function($value, $key);
831
            }
832
833
            if (!$shouldDrop) {
834
                yield $key => $value;
835
            }
836
        }
837
    };
838
839
    return new Collection($generatorFactory);
840
}
841
842
/**
843
 * Returns a lazy collection of items from $collection until first item for which $function returns false.
@@ 849-865 (lines=17) @@
846
 * @param callable $function ($value, $key)
847
 * @return Collection
848
 */
849
function takeWhile($collection, callable $function)
850
{
851
    $generatorFactory = function () use ($collection, $function) {
852
        $shouldTake = true;
853
        foreach ($collection as $key => $value) {
854
            if ($shouldTake) {
855
                $shouldTake = $function($value, $key);
856
            }
857
858
            if ($shouldTake) {
859
                yield $key => $value;
860
            }
861
        }
862
    };
863
864
    return new Collection($generatorFactory);
865
}
866
867
/**
868
 * Returns a lazy collection. A result of calling map and flatten(1)
@@ 941-954 (lines=14) @@
938
 * @param mixed $startValue
939
 * @return Collection
940
 */
941
function reductions($collection, callable $function, $startValue)
942
{
943
    $generatorFactory = function () use ($collection, $function, $startValue) {
944
        $tmp = duplicate($startValue);
945
946
        yield $tmp;
947
        foreach ($collection as $key => $value) {
948
            $tmp = $function($tmp, $value, $key);
949
            yield $tmp;
950
        }
951
    };
952
953
    return new Collection($generatorFactory);
954
}
955
956
/**
957
 * Returns a lazy collection of every nth ($step) item in  $collection.