Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4111924
OutputFileToStream.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
912 B
Referenced Files
None
Subscribers
None
OutputFileToStream.php
View Options
<?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
Details
Attached
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)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment