Documentation

StreamFactory
in package
implements StreamFactoryInterface

Phrity\Net\StreamFactory class.

Tags
see
https://www.php-fig.org/psr/psr-17/#24-streamfactoryinterface

Table of Contents

Interfaces

StreamFactoryInterface

Properties

$handler  : mixed
$modes  : mixed

Methods

__construct()  : mixed
Create new stream wrapper instance.
createSocketClient()  : SocketClient
Create a new socket client.
createSocketServer()  : SocketServer
Create a new socket server.
createSocketStreamFromResource()  : SocketStream
Create a new ocket stream from an existing resource.
createStream()  : Stream
Create a new stream from a string.
createStreamCollection()  : StreamCollection
Create a new stream collection.
createStreamFromFile()  : Stream
Create a stream from an existing file.
createStreamFromResource()  : Stream
Create a new stream from an existing resource.

Properties

$modes

private static mixed $modes = ['r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+', 'e']

Methods

__construct()

Create new stream wrapper instance.

public __construct() : mixed

createSocketStreamFromResource()

Create a new ocket stream from an existing resource.

public createSocketStreamFromResource(resource $resource) : SocketStream

The stream MUST be readable and may be writable.

Parameters
$resource : resource

The PHP resource to use as the basis for the stream.

Return values
SocketStream

A socket stream instance.

createStream()

Create a new stream from a string.

public createStream([string $content = '' ]) : Stream
Parameters
$content : string = ''

String content with which to populate the stream.

Return values
Stream

A stream instance.

createStreamFromFile()

Create a stream from an existing file.

public createStreamFromFile(string $filename[, string $mode = 'r' ]) : Stream
Parameters
$filename : string

The filename or stream URI to use as basis of stream.

$mode : string = 'r'

The mode with which to open the underlying filename/stream.

Tags
throws
RuntimeException

If the file cannot be opened.

throws
InvalidArgumentException

If the mode is invalid.

Return values
Stream

A stream instance.

createStreamFromResource()

Create a new stream from an existing resource.

public createStreamFromResource(resource $resource) : Stream

The stream MUST be readable and may be writable.

Parameters
$resource : resource

The PHP resource to use as the basis for the stream.

Return values
Stream

A stream instance.


        
On this page

Search results