StreamFactoryInterface
in
Table of Contents
Methods
- createStream() : StreamInterface
- Create a new stream from a string.
- createStreamFromFile() : StreamInterface
- Create a stream from an existing file.
- createStreamFromResource() : StreamInterface
- Create a new stream from an existing resource.
Methods
createStream()
Create a new stream from a string.
public
createStream([string $content = '' ]) : StreamInterface
The stream SHOULD be created with a temporary resource.
Parameters
- $content : string = ''
-
String content with which to populate the stream.
Return values
StreamInterfacecreateStreamFromFile()
Create a stream from an existing file.
public
createStreamFromFile(string $filename[, string $mode = 'r' ]) : StreamInterface
The file MUST be opened using the given mode, which may be any mode
supported by the fopen
function.
The $filename
MAY be any string supported by fopen()
.
Parameters
- $filename : string
-
Filename or stream URI to use as basis of stream.
- $mode : string = 'r'
-
Mode with which to open the underlying filename/stream.
Tags
Return values
StreamInterfacecreateStreamFromResource()
Create a new stream from an existing resource.
public
createStreamFromResource(resource $resource) : StreamInterface
The stream MUST be readable and may be writable.
Parameters
- $resource : resource
-
PHP resource to use as basis of stream.