Page MenuHomeWickedGov Phorge

OutputFileToStream.php
No OneTemporary

Size
912 B
Referenced Files
None
Subscribers
None

OutputFileToStream.php

<?php
namespace Shellbox\Command;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;
use Shellbox\FileUtils;
use Shellbox\Multipart\MultipartReader;
/**
* Encapsulation of an output file that is copied to a stream
*/
class OutputFileToStream extends OutputFileWithContents {
/** @var StreamInterface */
private $stream;
/**
* @internal
* @param StreamInterface $stream
*/
public function __construct( StreamInterface $stream ) {
$this->stream = $stream;
}
public function copyFromFile( $sourcePath ) {
Utils::copyToStream( FileUtils::openInputFileStream( $sourcePath ), $this->stream );
$this->setReceived();
}
public function getContents() {
$this->stream->rewind();
return $this->stream->getContents();
}
public function readFromMultipart( MultipartReader $multipartReader ) {
$multipartReader->copyPartToStream( $this->stream );
$this->setReceived();
}
}

File Metadata

Mime Type
text/x-php
Expires
Tue, Aug 18, 22:36 (12 h, 48 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
80/a4/993094de27e756ba9681b841a93d
Default Alt Text
OutputFileToStream.php (912 B)

Event Timeline