body = $body; $this->length = strlen($body); } public function getLength(): int { return $this->length; } public function getPosition(): int { return $this->position; } public function stepBack(): void { $this->position = max(0, $this->position - 1); } public function readByte(): int { if($this->position + 1 >= $this->length) return FWIF::TRAILER; return ord($this->body[$this->position++]); } public function readChar(): string { return chr($this->readByte()); } public function readString(int $length): string { // Bounds checks? What are those? $string = substr($this->body, $this->position, $length); $this->position += $length; return $string; } }