Code Duplication    Length = 21-21 lines in 2 locations

src/BufferUnpacker.php 2 locations

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