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

@@ 835-851 (lines=17) @@
832
 * @param callable $function ($value, $key)
833
 * @return Collection
834
 */
835
function dropWhile($collection, callable $function)
836
{
837
    $generatorFactory = function () use ($collection, $function) {
838
        $shouldDrop = true;
839
        foreach ($collection as $key => $value) {
840
            if ($shouldDrop) {
841
                $shouldDrop = $function($value, $key);
842
            }
843
844
            if (!$shouldDrop) {
845
                yield $key => $value;
846
            }
847
        }
848
    };
849
850
    return new Collection($generatorFactory);
851
}
852
853
/**
854
 * Returns a lazy collection of items from $collection until first item for which $function returns false.
@@ 860-876 (lines=17) @@
857
 * @param callable $function ($value, $key)
858
 * @return Collection
859
 */
860
function takeWhile($collection, callable $function)
861
{
862
    $generatorFactory = function () use ($collection, $function) {
863
        $shouldTake = true;
864
        foreach ($collection as $key => $value) {
865
            if ($shouldTake) {
866
                $shouldTake = $function($value, $key);
867
            }
868
869
            if ($shouldTake) {
870
                yield $key => $value;
871
            }
872
        }
873
    };
874
875
    return new Collection($generatorFactory);
876
}
877
878
/**
879
 * Returns a lazy collection. A result of calling map and flatten(1)
@@ 952-965 (lines=14) @@
949
 * @param mixed $startValue
950
 * @return Collection
951
 */
952
function reductions($collection, callable $function, $startValue)
953
{
954
    $generatorFactory = function () use ($collection, $function, $startValue) {
955
        $tmp = duplicate($startValue);
956
957
        yield $tmp;
958
        foreach ($collection as $key => $value) {
959
            $tmp = $function($tmp, $value, $key);
960
            yield $tmp;
961
        }
962
    };
963
964
    return new Collection($generatorFactory);
965
}
966
967
/**
968
 * Returns a lazy collection of every nth ($step) item in  $collection.