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 = 31-34 lines in 3 locations

src/Map.php 1 location

@@ 279-309 (lines=31) @@
276
    /**
277
     * {@inheritdoc}
278
     */
279
    public function groupBy(callable $discriminator): MapInterface
280
    {
281
        if ($this->size() === 0) {
282
            throw new GroupEmptyMapException;
283
        }
284
285
        $map = null;
286
287
        foreach ($this->pairs as $pair) {
288
            $key = $discriminator($pair->key(), $pair->value());
289
290
            if ($map === null) {
291
                $type = gettype($key);
292
                $map = new self(
293
                    $type === 'object' ? get_class($key) : $type,
294
                    SequenceInterface::class
295
                );
296
            }
297
298
            if ($map->contains($key)) {
299
                $map = $map->put(
300
                    $key,
301
                    $map->get($key)->add($pair)
302
                );
303
            } else {
304
                $map = $map->put($key, new Sequence($pair));
305
            }
306
        }
307
308
        return $map;
309
    }
310
311
    /**
312
     * {@inheritdoc}

src/Sequence.php 1 location

@@ 213-243 (lines=31) @@
210
    /**
211
     * {@inheritdoc}
212
     */
213
    public function groupBy(callable $discriminator): MapInterface
214
    {
215
        if ($this->size() === 0) {
216
            throw new GroupEmptySequenceException;
217
        }
218
219
        $map = null;
220
221
        foreach ($this->values as $value) {
222
            $key = $discriminator($value);
223
224
            if ($map === null) {
225
                $type = gettype($key);
226
                $map = new Map(
227
                    $type === 'object' ? get_class($key) : $type,
228
                    SequenceInterface::class
229
                );
230
            }
231
232
            if ($map->contains($key)) {
233
                $map = $map->put(
234
                    $key,
235
                    $map->get($key)->add($value)
236
                );
237
            } else {
238
                $map = $map->put($key, new self($value));
239
            }
240
        }
241
242
        return $map;
243
    }
244
245
    /**
246
     * {@inheritdoc}

src/Stream.php 1 location

@@ 226-259 (lines=34) @@
223
    /**
224
     * {@inheritdoc}
225
     */
226
    public function groupBy(callable $discriminator): MapInterface
227
    {
228
        if ($this->size() === 0) {
229
            throw new GroupEmptySequenceException;
230
        }
231
232
        $map = null;
233
234
        foreach ($this->values as $value) {
235
            $key = $discriminator($value);
236
237
            if ($map === null) {
238
                $type = gettype($key);
239
                $map = new Map(
240
                    $type === 'object' ? get_class($key) : $type,
241
                    StreamInterface::class
242
                );
243
            }
244
245
            if ($map->contains($key)) {
246
                $map = $map->put(
247
                    $key,
248
                    $map->get($key)->add($value)
249
                );
250
            } else {
251
                $map = $map->put(
252
                    $key,
253
                    (new self((string) $this->type))->add($value)
254
                );
255
            }
256
        }
257
258
        return $map;
259
    }
260
261
    /**
262
     * {@inheritdoc}