Code Duplication    Length = 20-20 lines in 2 locations

src/BufferUnpacker.php 2 locations

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