WordPress\AiClientDependencies\Nyholm\Psr7

Stream::writepublicWP 1.0

Method of the class: Stream{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Stream = new Stream();
$Stream->write( $string ): int;
$string(required)
.

Stream::write() code WP 7.0

public function write($string): int
{
    if (!isset($this->stream)) {
        throw new \RuntimeException('Stream is detached');
    }
    if (!$this->writable) {
        throw new \RuntimeException('Cannot write to a non-writable stream');
    }
    // We can't know the size after writing anything
    $this->size = null;
    if (\false === $result = @\fwrite($this->stream, $string)) {
        throw new \RuntimeException('Unable to write to stream: ' . (\error_get_last()['message'] ?? ''));
    }
    return $result;
}