Copied!

Calls preg_replace on each read operation with the passed pattern and replacement string. Should only really be used to find single characters, since a pattern intended to match more may be split across multiple read() operations.

CloneableInstantiable
Methods
public __call(string $method, array $args)
 

Allow decorators to implement custom methods

  • return mixed
public __construct(Psr\Http\Message\StreamInterface $stream, string $pattern, string $replacement)
public __get(string $name)
 

Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).

  • return \StreamInterface
public __toString() : string
public close() : void
public detach()
public eof() : bool
 

Returns true if the end of stream has been reached.

public getContents() : string
public getMetadata( $key = NULL)
 
  • return mixed
public getSize() : ?int
public isReadable() : bool
public isSeekable() : bool
 

Overridden to return false

public isWritable() : bool
public read( $length) : string
 

Reads from the underlying stream, filters it and returns up to $length bytes.

  • param int $length
  • return string
public rewind() : void
public seek( $offset, $whence = 0ZBateson\StreamDecorators\SEEK_SET) : void
 

Not supported by PregReplaceFilterStream

  • param int $offset
  • param int $whence
  • throws \RuntimeException
public tell() : int
public write( $string) : int
Methods
protected createStream() : Psr\Http\Message\StreamInterface
 

Implement in subclasses to dynamically create streams when requested.

  • throws \BadMethodCallException
Properties
private $buffer = NULL
 
  • var \BufferStream Buffered stream of input from the underlying stream
private $pattern = NULL
 
  • var string The regex pattern
private $replacement = NULL
 
  • var string The replacement
private $stream = NULL
 
  • var \StreamInterface $stream
Methods
private fillBuffer(int $length) : void
 

Fills the BufferStream with at least 8192 characters of input for future read operations.

© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration