Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5968517
InputFileFromStream.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
787 B
Referenced Files
None
Subscribers
None
InputFileFromStream.php
View Options
<?php
namespace
Shellbox\Command
;
use
GuzzleHttp\Psr7\Utils
;
use
Psr\Http\Message\StreamInterface
;
use
Shellbox\FileUtils
;
class
InputFileFromStream
extends
InputFileWithContents
{
/** @var StreamInterface */
private
$stream
;
/**
* @internal
* @param StreamInterface $stream
*/
public
function
__construct
(
StreamInterface
$stream
)
{
$this
->
stream
=
$stream
;
}
public
function
copyTo
(
$destPath
)
{
// Rewind for consistency with getStreamOrString()
$this
->
stream
->
rewind
();
Utils
::
copyToStream
(
$this
->
stream
,
FileUtils
::
openOutputFileStream
(
$destPath
)
);
}
public
function
getStreamOrString
()
{
// The client needs to read it twice.
// Rewind, otherwise we may get different results each time.
$this
->
stream
->
rewind
();
return
$this
->
stream
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 13:07 (2 d, 3 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
38/5c/fe83a1eace884e4e8c20d563c056
Default Alt Text
InputFileFromStream.php (787 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment