Code Duplication    Length = 12-14 lines in 2 locations

src/BufferUnpacker.php 2 locations

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