public function Stream::write in Zircon Profile 8
Same name in this branch
- 8 vendor/zendframework/zend-diactoros/src/Stream.php \Zend\Diactoros\Stream::write()
- 8 vendor/guzzlehttp/psr7/src/Stream.php \GuzzleHttp\Psr7\Stream::write()
- 8 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Stream.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Stream::write()
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/psr7/src/Stream.php \GuzzleHttp\Psr7\Stream::write()
Write data to the stream.
Parameters
string $string The string that is to be written.:
Return value
int Returns the number of bytes written to the stream.
Throws
\RuntimeException on failure.
Overrides StreamInterface::write
File
- vendor/
guzzlehttp/ psr7/ src/ Stream.php, line 214
Class
- Stream
- PHP stream implementation.
Namespace
GuzzleHttp\Psr7Code
public function write($string) {
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;
$result = fwrite($this->stream, $string);
if ($result === false) {
throw new \RuntimeException('Unable to write to stream');
}
return $result;
}