ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ILIAS\Filesystem\Stream\Streams Class Reference

Class Streams. More...

+ Collaboration diagram for ILIAS\Filesystem\Stream\Streams:

Static Public Member Functions

static ofString ($string)
 Creates a new stream with an initial value. More...
 
static ofResource ($resource)
 Wraps an already created resource with the stream abstraction. More...
 
static ofPsr7Stream (StreamInterface $stream)
 Create a FileStream from a Psr7 compliant stream. More...
 

Detailed Description

Class Streams.

Stream factory which enables the user to create streams without the knowledge of the concrete class.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Since
5.3
Version
1.1.0

Definition at line 19 of file Streams.php.

Member Function Documentation

◆ ofPsr7Stream()

static ILIAS\Filesystem\Stream\Streams::ofPsr7Stream ( StreamInterface  $stream)
static

Create a FileStream from a Psr7 compliant stream.

Please not that the stream must be detached from the psr7 stream in order to create the filesystem stream.

Parameters
StreamInterface$streamThe stream which should be parsed into a FileStream.
Returns
FileStream The newly created stream.

Definition at line 69 of file Streams.php.

References Psr\Http\Message\StreamInterface\detach().

Referenced by ILIAS\FileUpload\FileUploadImpl\moveFilesTo(), ILIAS\FileUpload\FileUploadImpl\moveOneFileTo(), and ILIAS\FileUpload\FileUploadImpl\register().

69  : FileStream
70  {
71  $resource = $stream->detach();
72  return self::ofResource($resource);
73  }
$stream
PHP stream implementation.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ofResource()

static ILIAS\Filesystem\Stream\Streams::ofResource (   $resource)
static

Wraps an already created resource with the stream abstraction.

The stream abstraction only supports streams which are opened with fopen.

Parameters
resource$resourceThe resource which should be wrapped.
Returns
FileStream The newly created stream which wraps the given resource.
See also
fopen()

Definition at line 52 of file Streams.php.

Referenced by ilStudyProgrammeType\processAndStoreIconFile(), and ILIAS\Filesystem\Provider\FlySystem\FlySystemFileStreamAccess\readStream().

52  : FileStream
53  {
54  if (!is_resource($resource)) {
55  throw new \InvalidArgumentException('The argument $resource must be of type resource but was "' . gettype($resource) . '"');
56  }
57 
58  return new Stream($resource);
59  }
+ Here is the caller graph for this function:

◆ ofString()

static ILIAS\Filesystem\Stream\Streams::ofString (   $string)
static

Creates a new stream with an initial value.

Please note that the whole stream is stored within memory.

Parameters
string$stringThe string which should be written as initial value.
Returns
FileStream The newly created in memory stream.

Definition at line 30 of file Streams.php.

References GuzzleHttp\Psr7\$stream.

Referenced by ilPropertyFormGUI\checkInput(), ilCtrl\redirectToURL(), ilTemplate\show(), ILIAS\FileUpload\Processor\VirusScannerPreProcessorTest\testNoVirusDetected(), ILIAS\FileUpload\Processor\BlacklistExtensionPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\BlacklistFileHeaderPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\FilenameOverridePreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\WhitelistExtensionPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\FileUploadImplTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\BlacklistExtensionPreProcessorTest\testProcessWithBlacklistedEmptyExtensionWhichShouldGetRejected(), ILIAS\FileUpload\Processor\BlacklistExtensionPreProcessorTest\testProcessWithBlacklistedExtensionWhichShouldGetRejected(), ILIAS\FileUpload\FileUploadImplTest\testProcessWithFailedUploadWhichShouldGetRejected(), ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessorTest\testProcessWithHeaderMismatchWhichShouldGetRejected(), ILIAS\FileUpload\Processor\BlacklistFileHeaderPreProcessorTest\testProcessWithHeaderMismatchWhichShouldGetRejected(), ILIAS\FileUpload\Processor\WhitelistExtensionPreProcessorTest\testProcessWithoutExtensionWhichShouldSucceed(), ILIAS\FileUpload\Processor\WhitelistExtensionPreProcessorTest\testProcessWithoutWhitelistedExtensionWhichShouldGetRejected(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWithGeneralFailureWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithGeneralFailureWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithMissingFileWhichShouldFail(), ILIAS\FileUpload\Processor\VirusScannerPreProcessorTest\testVirusDetected(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithExistingFileWhichShouldFail(), and Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithFailingAdapterWhichShouldFail().

30  : FileStream
31  {
32  if (!is_string($string)) {
33  throw new \InvalidArgumentException('The argument $string must be of type string but was "' . gettype($string) . '"');
34  }
35 
36  $stream = new Stream(fopen('php://memory', 'rw'));
37  $stream->write($string);
38  return $stream;
39  }
$stream
PHP stream implementation.
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: