Code Duplication    Length = 11-12 lines in 2 locations

src/BufferUnpacker.php 2 locations

@@ 111-122 (lines=12) @@
108
        return $this;
109
    }
110
111
    public function skip(int $length) : self
112
    {
113
        $offset = $this->offset + $length;
114
115
        if (!isset($this->buffer[$offset])) {
116
            throw new InsufficientDataException("Unable to seek to position $offset");
117
        }
118
119
        $this->offset = $offset;
120
121
        return $this;
122
    }
123
124
    public function getRemainingCount() : int
125
    {
@@ 152-162 (lines=11) @@
149
     *
150
     * @return string
151
     */
152
    public function read($length)
153
    {
154
        if (!isset($this->buffer[$this->offset + $length - 1])) {
155
            throw new InsufficientDataException();
156
        }
157
158
        $data = \substr($this->buffer, $this->offset, $length);
159
        $this->offset += $length;
160
161
        return $data;
162
    }
163
164
    public function tryUnpack() : array
165
    {