stream = $resource; } /** * @throws WebAuthnException */ public function take(int $length): string { if ($length < 0) { throw new WebAuthnException(); } if ($length === 0) { return ''; } $string = fread($this->stream, $length); if ($string === false) { throw new WebAuthnException(); } return $string; } /** * @throws WebAuthnException */ public function getPosition(): int { $position = ftell($this->stream); if ($position === false) { throw new WebAuthnException(); } return $position; } }