StreamFactoryInterface

interface Firstred\PostNL\Factory\StreamFactoryInterface
Factory for PSR-7 Stream.

Summary

Methods

Methods

public Firstred\PostNL\Factory\StreamFactoryInterface::createStream($content=\'\')
Create a new stream from a string.
The stream SHOULD be created with a temporary resource.
Parameters:
  • $content (string) String content with which to populate the stream.

Returns:

\Psr\Http\Message\StreamInterface

public Firstred\PostNL\Factory\StreamFactoryInterface::createStreamFromFile($filename, $mode=\'r\')
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:
  • $filename (string) Filename or stream URI to use as basis of stream.

  • $mode (string) Mode with which to open the underlying filename/stream.

Returns:

\Psr\Http\Message\StreamInterface

Throws:

\RuntimeException If the file cannot be opened.

Throws:

\InvalidArgumentException If the mode is invalid.

Throws:

\RuntimeException If the file cannot be opened.

Throws:

\InvalidArgumentException If the mode is invalid.

public Firstred\PostNL\Factory\StreamFactoryInterface::createStreamFromResource($resource)
Create a new stream from an existing resource.
The stream MUST be readable and may be writable.
Parameters:
  • $resource (resource) PHP resource to use as basis of stream.

Returns:

\Psr\Http\Message\StreamInterface