Code Duplication    Length = 21-21 lines in 2 locations

src/BufferUnpacker.php 2 locations

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