Code Duplication    Length = 21-21 lines in 2 locations

src/BufferUnpacker.php 2 locations

@@ 387-407 (lines=21) @@
384
        return $array;
385
    }
386
387
    public function unpackArrayHeader()
388
    {
389
        if (!isset($this->buffer[$this->offset])) {
390
            throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1);
391
        }
392
393
        $c = \ord($this->buffer[$this->offset]);
394
        ++$this->offset;
395
396
        if ($c >= 0x90 && $c <= 0x9f) {
397
            return $c & 0xf;
398
        }
399
        if (0xdc === $c) {
400
            return $this->unpackUint16();
401
        }
402
        if (0xdd === $c) {
403
            return $this->unpackUint32();
404
        }
405
406
        throw UnpackingFailedException::unexpectedCode($c, 'array header');
407
    }
408
409
    public function unpackMap()
410
    {
@@ 421-441 (lines=21) @@
418
        return $map;
419
    }
420
421
    public function unpackMapHeader()
422
    {
423
        if (!isset($this->buffer[$this->offset])) {
424
            throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1);
425
        }
426
427
        $c = \ord($this->buffer[$this->offset]);
428
        ++$this->offset;
429
430
        if ($c >= 0x80 && $c <= 0x8f) {
431
            return $c & 0xf;
432
        }
433
        if (0xde === $c) {
434
            return $this->unpackUint16();
435
        }
436
        if (0xdf === $c) {
437
            return $this->unpackUint32();
438
        }
439
440
        throw UnpackingFailedException::unexpectedCode($c, 'map header');
441
    }
442
443
    public function unpackExt()
444
    {