Copied!

Compose stream implementations based on a hash of functions.

Allows for easy testing and extension of a provided stream without needing to create a concrete class for a simple extension point.

CloneableFinalInstantiable
Methods
public __construct(array $methods)
 
  • param array<string,callable> $methods Hash of method name to a callable.
public __destruct()
 

The close method is called on the underlying stream only if possible.

public __get(string $name) : void
 

Lazily determine which methods are not implemented.

  • throws \BadMethodCallException
public __toString() : string
public __wakeup() : void
 

An unserialize would allow the __destruct to run when the unserialized value goes out of scope.

  • throws \LogicException
public close() : void
public static decorate(Psr\Http\Message\StreamInterface $stream, array $methods)
 

Adds custom functionality to an underlying stream by intercepting specific method calls.

  • param \StreamInterface $stream Stream to decorate
  • param array<string,callable> $methods Hash of method name to a closure
  • return \FnStream
public detach()
public eof() : bool
public getContents() : string
public getMetadata( $key = NULL)
 
  • return mixed
public getSize() : ?int
public isReadable() : bool
public isSeekable() : bool
public isWritable() : bool
public read( $length) : string
public rewind() : void
public seek( $offset, $whence = 0GuzzleHttp\Psr7\SEEK_SET) : void
public tell() : int
public write( $string) : int
Constants
private GuzzleHttp\Psr7\FnStream::SLOTS = ['__toString', 'close', 'detach', 'rewind', 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write', 'isReadable', 'read', 'getContents', 'getMetadata']
Properties
private $methods = NULL
 
  • var array<string,callable>
Methods
public static decorate(Psr\Http\Message\StreamInterface $stream, array $methods)
 

Adds custom functionality to an underlying stream by intercepting specific method calls.

  • param \StreamInterface $stream Stream to decorate
  • param array<string,callable> $methods Hash of method name to a closure
  • return \FnStream
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration