Code Duplication    Length = 21-21 lines in 2 locations

src/BufferUnpacker.php 2 locations

@@ 344-364 (lines=21) @@
341
        return $array;
342
    }
343
344
    public function unpackArrayHeader()
345
    {
346
        if (!isset($this->buffer[$this->offset])) {
347
            throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1);
348
        }
349
350
        $c = \ord($this->buffer[$this->offset]);
351
        ++$this->offset;
352
353
        if ($c >= 0x90 && $c <= 0x9f) {
354
            return $c & 0xf;
355
        }
356
        if (0xdc === $c) {
357
            return $this->unpackUint16();
358
        }
359
        if (0xdd === $c) {
360
            return $this->unpackUint32();
361
        }
362
363
        throw UnpackingFailedException::unexpectedCode($c, 'array header');
364
    }
365
366
    public function unpackMap()
367
    {
@@ 378-398 (lines=21) @@
375
        return $map;
376
    }
377
378
    public function unpackMapHeader()
379
    {
380
        if (!isset($this->buffer[$this->offset])) {
381
            throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1);
382
        }
383
384
        $c = \ord($this->buffer[$this->offset]);
385
        ++$this->offset;
386
387
        if ($c >= 0x80 && $c <= 0x8f) {
388
            return $c & 0xf;
389
        }
390
        if (0xde === $c) {
391
            return $this->unpackUint16();
392
        }
393
        if (0xdf === $c) {
394
            return $this->unpackUint32();
395
        }
396
397
        throw UnpackingFailedException::unexpectedCode($c, 'map header');
398
    }
399
400
    public function unpackExt()
401
    {