Basicis - Core

Logo

As the name says, it is made to be basic and direct.

View the Project on GitHub basicis/core

Basicis\Http\Message\StreamFactory

StreamFactory class

Implements:

Psr\Http\Message\StreamFactoryInterface

Methods

Name Description
createStream Function createStream
Create a new stream from a string.  
createStreamFromFile Function createStreamFromFile
Create a stream from an existing file.  
createStreamFromResource Create a new stream from an existing resource.

StreamFactory::createStream

Description

public createStream (string $content)

Function createStream Create a new stream from a string.

The stream SHOULD be created with a temporary resource.

Parameters

Return Values

\StreamInterface


StreamFactory::createStreamFromFile

Description

public createStreamFromFile (string $filename, string $mode)

Function createStreamFromFile Create a stream from an existing file.

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

Return Values

\StreamInterface

Throws Exceptions

\RuntimeException

If the file cannot be opened.

\InvalidArgumentException

If the mode is invalid.


StreamFactory::createStreamFromResource

Description

public createStreamFromResource (resource $resource)

Create a new stream from an existing resource.

The stream MUST be readable and may be writable.

Parameters

Return Values

\StreamInterface