Code Duplication    Length = 20-20 lines in 2 locations

src/BufferUnpacker.php 2 locations

@@ 334-353 (lines=20) @@
331
        return $array;
332
    }
333
334
    public function unpackArrayHeader()
335
    {
336
        if (!isset($this->buffer[$this->offset])) {
337
            throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 1);
338
        }
339
340
        $c = \ord($this->buffer[$this->offset++]);
341
342
        if ($c >= 0x90 && $c <= 0x9f) {
343
            return $c & 0xf;
344
        }
345
        if (0xdc === $c) {
346
            return $this->unpackUint16();
347
        }
348
        if (0xdd === $c) {
349
            return $this->unpackUint32();
350
        }
351
352
        throw InvalidCodeException::fromExpectedType('array header', $c);
353
    }
354
355
    public function unpackMap()
356
    {
@@ 367-386 (lines=20) @@
364
        return $map;
365
    }
366
367
    public function unpackMapHeader()
368
    {
369
        if (!isset($this->buffer[$this->offset])) {
370
            throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 1);
371
        }
372
373
        $c = \ord($this->buffer[$this->offset++]);
374
375
        if ($c >= 0x80 && $c <= 0x8f) {
376
            return $c & 0xf;
377
        }
378
        if (0xde === $c) {
379
            return $this->unpackUint16();
380
        }
381
        if (0xdf === $c) {
382
            return $this->unpackUint32();
383
        }
384
385
        throw InvalidCodeException::fromExpectedType('map header', $c);
386
    }
387
388
    public function unpackExt()
389
    {