WordPress\AiClientDependencies\Nyholm\Psr7

Stream::getContents │ public │ WP 1.0

Метод класса: Stream{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Stream = new Stream();
$Stream->getContents(): string;

Код Stream::getContents() WP 7.1.2

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();
    }
}