Code Duplication    Length = 13-13 lines in 5 locations

src/BufferUnpacker.php 5 locations

@@ 438-450 (lines=13) @@
435
        return $hi << 8 | $lo;
436
    }
437
438
    private function unpackUint32()
439
    {
440
        if (!isset($this->buffer[$this->offset + 3])) {
441
            throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4);
442
        }
443
444
        $num = \substr($this->buffer, $this->offset, 4);
445
        $this->offset += 4;
446
447
        $num = \unpack('N', $num);
448
449
        return $num[1];
450
    }
451
452
    private function unpackUint64()
453
    {
@@ 502-514 (lines=13) @@
499
        return $hi << 8 | $lo;
500
    }
501
502
    private function unpackInt32()
503
    {
504
        if (!isset($this->buffer[$this->offset + 3])) {
505
            throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4);
506
        }
507
508
        $num = \substr($this->buffer, $this->offset, 4);
509
        $this->offset += 4;
510
511
        $num = \unpack('i', \strrev($num));
512
513
        return $num[1];
514
    }
515
516
    private function unpackInt64()
517
    {
@@ 516-528 (lines=13) @@
513
        return $num[1];
514
    }
515
516
    private function unpackInt64()
517
    {
518
        if (!isset($this->buffer[$this->offset + 7])) {
519
            throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 8);
520
        }
521
522
        $num = \substr($this->buffer, $this->offset, 8);
523
        $this->offset += 8;
524
525
        $set = \unpack('N2', $num);
526
527
        return $set[1] << 32 | $set[2];
528
    }
529
530
    private function unpackFloat32()
531
    {
@@ 530-542 (lines=13) @@
527
        return $set[1] << 32 | $set[2];
528
    }
529
530
    private function unpackFloat32()
531
    {
532
        if (!isset($this->buffer[$this->offset + 3])) {
533
            throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 4);
534
        }
535
536
        $num = \substr($this->buffer, $this->offset, 4);
537
        $this->offset += 4;
538
539
        $num = \unpack('f', \strrev($num));
540
541
        return $num[1];
542
    }
543
544
    private function unpackFloat64()
545
    {
@@ 544-556 (lines=13) @@
541
        return $num[1];
542
    }
543
544
    private function unpackFloat64()
545
    {
546
        if (!isset($this->buffer[$this->offset + 7])) {
547
            throw InsufficientDataException::fromOffset($this->buffer, $this->offset, 8);
548
        }
549
550
        $num = \substr($this->buffer, $this->offset, 8);
551
        $this->offset += 8;
552
553
        $num = \unpack('d', \strrev($num));
554
555
        return $num[1];
556
    }
557
558
    private function unpackStrData($length)
559
    {