Code Duplication    Length = 21-21 lines in 2 locations

src/BufferUnpacker.php 2 locations

@@ 359-379 (lines=21) @@
356
        return $array;
357
    }
358
359
    public function unpackArrayHeader()
360
    {
361
        if (!isset($this->buffer[$this->offset])) {
362
            throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1);
363
        }
364
365
        $c = \ord($this->buffer[$this->offset]);
366
        ++$this->offset;
367
368
        if ($c >= 0x90 && $c <= 0x9f) {
369
            return $c & 0xf;
370
        }
371
        if (0xdc === $c) {
372
            return $this->unpackUint16();
373
        }
374
        if (0xdd === $c) {
375
            return $this->unpackUint32();
376
        }
377
378
        throw UnpackingFailedException::unexpectedCode($c, 'array header');
379
    }
380
381
    public function unpackMap()
382
    {
@@ 393-413 (lines=21) @@
390
        return $map;
391
    }
392
393
    public function unpackMapHeader()
394
    {
395
        if (!isset($this->buffer[$this->offset])) {
396
            throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1);
397
        }
398
399
        $c = \ord($this->buffer[$this->offset]);
400
        ++$this->offset;
401
402
        if ($c >= 0x80 && $c <= 0x8f) {
403
            return $c & 0xf;
404
        }
405
        if (0xde === $c) {
406
            return $this->unpackUint16();
407
        }
408
        if (0xdf === $c) {
409
            return $this->unpackUint32();
410
        }
411
412
        throw UnpackingFailedException::unexpectedCode($c, 'map header');
413
    }
414
415
    public function unpackExt()
416
    {