You are here

protected function MultipartStream::createStream in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/psr7/src/MultipartStream.php \GuzzleHttp\Psr7\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 65

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) {
  $stream = new AppendStream();
  foreach ($elements as $element) {
    $this
      ->addElement($stream, $element);
  }

  // Add the trailing boundary with CRLF
  $stream
    ->addStream(stream_for("--{$this->boundary}--\r\n"));
  return $stream;
}