Code Duplication    Length = 16-16 lines in 3 locations

src/Stream.php 3 locations

@@ 443-458 (lines=16) @@
440
     *
441
     * @return int
442
     */
443
    public function readUInt16()
444
    {
445
        switch ($this->getByteOrder()) {
446
            case ByteOrder::BIG_ENDIAN:
447
                $format = 'n';
448
                break;
449
            case ByteOrder::LITTLE_ENDIAN:
450
                $format = 'v';
451
                break;
452
            default:
453
                $format = 'S';
454
        }
455
456
        list(, $value) = unpack($format, $this->read(2));
457
        return $value;
458
    }
459
460
    /**
461
     * Read signed 24-bit integer data from the stream.
@@ 519-534 (lines=16) @@
516
     *
517
     * @return int
518
     */
519
    public function readUInt32()
520
    {
521
        switch ($this->getByteOrder()) {
522
            case ByteOrder::BIG_ENDIAN:
523
                $format = 'N';
524
                break;
525
            case ByteOrder::LITTLE_ENDIAN:
526
                $format = 'V';
527
                break;
528
            default:
529
                $format = 'L';
530
        }
531
532
        list(, $value) = unpack($format, $this->read(4));
533
        return $value;
534
    }
535
536
    /**
537
     * Read signed 48-bit integer data from the stream.
@@ 595-610 (lines=16) @@
592
     *
593
     * @return int
594
     */
595
    public function readUInt64()
596
    {
597
        switch ($this->getByteOrder()) {
598
            case ByteOrder::BIG_ENDIAN:
599
                $format = 'J';
600
                break;
601
            case ByteOrder::LITTLE_ENDIAN:
602
                $format = 'P';
603
                break;
604
            default:
605
                $format = 'Q';
606
        }
607
608
        list(, $value) = unpack($format, $this->read(8));
609
        return $value;
610
    }
611
612
    /**
613
     * Write data to the stream and return the number of bytes written.