| @@ 73-86 (lines=14) @@ | ||
| 70 | return $this; |
|
| 71 | } |
|
| 72 | ||
| 73 | public function seek(int $offset) : self |
|
| 74 | { |
|
| 75 | if ($offset < 0) { |
|
| 76 | $offset += \strlen($this->buffer); |
|
| 77 | } |
|
| 78 | ||
| 79 | if (!isset($this->buffer[$offset])) { |
|
| 80 | throw new \OutOfBoundsException("Unable to seek to position $offset."); |
|
| 81 | } |
|
| 82 | ||
| 83 | $this->offset = $offset; |
|
| 84 | ||
| 85 | return $this; |
|
| 86 | } |
|
| 87 | ||
| 88 | public function skip(int $offset) : self |
|
| 89 | { |
|
| @@ 88-99 (lines=12) @@ | ||
| 85 | return $this; |
|
| 86 | } |
|
| 87 | ||
| 88 | public function skip(int $offset) : self |
|
| 89 | { |
|
| 90 | $offset += $this->offset; |
|
| 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 withBuffer(string $buffer) : self |
|
| 102 | { |
|