Code Duplication    Length = 12-14 lines in 2 locations

src/BufferUnpacker.php 2 locations

@@ 98-111 (lines=14) @@
95
        return $this;
96
    }
97
98
    public function seek(int $offset) : self
99
    {
100
        if ($offset < 0) {
101
            $offset += \strlen($this->buffer);
102
        }
103
104
        if (!isset($this->buffer[$offset])) {
105
            throw new InsufficientDataException("Unable to seek to position $offset.");
106
        }
107
108
        $this->offset = $offset;
109
110
        return $this;
111
    }
112
113
    public function skip(int $length) : self
114
    {
@@ 113-124 (lines=12) @@
110
        return $this;
111
    }
112
113
    public function skip(int $length) : self
114
    {
115
        $offset = $this->offset + $length;
116
117
        if (!isset($this->buffer[$offset])) {
118
            throw new InsufficientDataException("Unable to seek to position $offset.");
119
        }
120
121
        $this->offset = $offset;
122
123
        return $this;
124
    }
125
126
    /**
127
     * @param int $length