Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Stream.php

function Stream::write

Overrides StreamInterface::write

File

vendor/guzzlehttp/psr7/src/Stream.php, line 246

Class

Stream
PHP stream implementation.

Namespace

GuzzleHttp\Psr7

Code

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;
    $result = fwrite($this->stream, $string);
    if ($result === false) {
        throw new \RuntimeException('Unable to write to stream');
    }
    return $result;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal