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

Breadcrumb

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

function MultipartStream::createStream

Create the aggregate stream that will be used to upload the POST data

Overrides StreamDecoratorTrait::createStream

1 call to MultipartStream::createStream()
MultipartStream::__construct in vendor/guzzlehttp/psr7/src/MultipartStream.php

File

vendor/guzzlehttp/psr7/src/MultipartStream.php, line 69

Class

MultipartStream
Stream that when read returns bytes for a streaming multipart or multipart/form-data stream.

Namespace

GuzzleHttp\Psr7

Code

protected function createStream(array $elements = []) : StreamInterface {
    $stream = new AppendStream();
    foreach ($elements as $element) {
        if (!is_array($element)) {
            throw new \UnexpectedValueException('An array is expected');
        }
        $this->addElement($stream, $element);
    }
    // Add the trailing boundary with CRLF
    $stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n"));
    return $stream;
}

API Navigation

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