public function build()
    {
        $streams = '';
        foreach ($this->data as $data) {
            // Add start and headers
            $streams .= "--{$this->getBoundary()}\r\n".
                $this->getHeaders($data['headers'])."\r\n";

            // Convert the stream to string
            /* @var $contentStream StreamInterface */
            $contentStream = $data['contents'];
            if ($contentStream->isSeekable()) {
                $streams .= $contentStream->__toString();
            } else {
                $streams .= $contentStream->getContents();
            }

            $streams .= "\r\n";
        }

        // Append end
        $streams .= "--{$this->getBoundary()}--\r\n";

        return $this->streamFactory->createStream($streams);
    }
public function build()
    {
        $streams = '';
        foreach ($this->data as $data) {
            // Add start and headers
            $streams .= "--{$this->getBoundary()}\r\n".
                $this->getHeaders($data['headers'])."\r\n";

            // Convert the stream to string
            /* @var $contentStream StreamInterface */
            $contentStream = $data['contents'];
            if ($contentStream->isSeekable()) {
                $streams .= $contentStream->__toString();
            } else {
                $streams .= $contentStream->getContents();
            }

            $streams .= "\r\n";
        }

        // Append end
        $streams .= "--{$this->getBoundary()}--\r\n";

        return $this->streamFactory->createStream($streams);
    }
public function build ( ) { $ streams = '' ; foreach ( $ this -> data as $ data ) { // Add start and headers $ streams .= "--{$this->getBoundary()}\r\n" . $ this -> getHeaders ( $ data [ 'headers' ] ) . "\r\n" ; // Convert the stream to string /* @var $contentStream StreamInterface */ $ contentStream = $ data [ 'contents' ] ; if ( $ contentStream -> isSeekable ( ) ) { $ streams .= $ contentStream -> __toString ( ) ; } else { $ streams .= $ contentStream -> getContents ( ) ; } $ streams .= "\r\n" ; } // Append end $ streams .= "--{$this->getBoundary()}--\r\n" ; return $ this -> streamFactory -> createStream ( $ streams ) ; }
Build the stream.

@return StreamInterface
Build the stream .