Code Duplication    Length = 21-21 lines in 2 locations

src/BufferUnpacker.php 2 locations

@@ 439-459 (lines=21) @@
436
        return $array;
437
    }
438
439
    public function unpackArrayHeader()
440
    {
441
        if (!isset($this->buffer[$this->offset])) {
442
            throw new InsufficientDataException();
443
        }
444
445
        $c = \ord($this->buffer[$this->offset]);
446
        ++$this->offset;
447
448
        if ($c >= 0x90 && $c <= 0x9f) {
449
            return $c & 0xf;
450
        }
451
        if (0xdc === $c) {
452
            return $this->unpackUint16();
453
        }
454
        if (0xdd === $c) {
455
            return $this->unpackUint32();
456
        }
457
458
        throw UnpackingFailedException::unexpectedCode($c, 'array');
459
    }
460
461
    public function unpackMap()
462
    {
@@ 473-493 (lines=21) @@
470
        return $map;
471
    }
472
473
    public function unpackMapHeader()
474
    {
475
        if (!isset($this->buffer[$this->offset])) {
476
            throw new InsufficientDataException();
477
        }
478
479
        $c = \ord($this->buffer[$this->offset]);
480
        ++$this->offset;
481
482
        if ($c >= 0x80 && $c <= 0x8f) {
483
            return $c & 0xf;
484
        }
485
        if (0xde === $c) {
486
            return $this->unpackUint16();
487
        }
488
        if (0xdf === $c) {
489
            return $this->unpackUint32();
490
        }
491
492
        throw UnpackingFailedException::unexpectedCode($c, 'map');
493
    }
494
495
    public function unpackExt()
496
    {