Code Duplication    Length = 12-14 lines in 2 locations

src/BufferUnpacker.php 2 locations

@@ 89-102 (lines=14) @@
86
        return $this;
87
    }
88
89
    public function seek(int $offset) : self
90
    {
91
        if ($offset < 0) {
92
            $offset += \strlen($this->buffer);
93
        }
94
95
        if (!isset($this->buffer[$offset])) {
96
            throw new \OutOfBoundsException("Unable to seek to position $offset.");
97
        }
98
99
        $this->offset = $offset;
100
101
        return $this;
102
    }
103
104
    public function skip(int $offset) : self
105
    {
@@ 104-115 (lines=12) @@
101
        return $this;
102
    }
103
104
    public function skip(int $offset) : self
105
    {
106
        $offset += $this->offset;
107
108
        if (!isset($this->buffer[$offset])) {
109
            throw new \OutOfBoundsException("Unable to seek to position $offset.");
110
        }
111
112
        $this->offset = $offset;
113
114
        return $this;
115
    }
116
117
    public function withBuffer(string $buffer) : self
118
    {