WordPress\AiClientDependencies\Nyholm\Psr7
Stream::getContents
Method of the class: Stream{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Stream = new Stream(); $Stream->getContents(): string;
Stream::getContents() Stream::getContents code WP 7.0
public function getContents(): string
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
}
$exception = null;
\set_error_handler(static function ($type, $message) use (&$exception) {
throw $exception = new \RuntimeException('Unable to read stream contents: ' . $message);
});
try {
return \stream_get_contents($this->stream);
} catch (\Throwable $e) {
throw $e === $exception ? $e : new \RuntimeException('Unable to read stream contents: ' . $e->getMessage(), 0, $e);
} finally {
\restore_error_handler();
}
}