Copied!

Inserts line ending characters after the set number of characters have been
written to the underlying stream.

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

Allow decorators to implement custom methods

  • return mixed
public __construct(Psr\Http\Message\StreamInterface $stream, int $lineLength = 76, string $lineEnding = ' ')
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
 
  • inheritDoc
public detach()
 
  • inheritDoc
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
 

Writes the passed string to the underlying stream, ensuring line endings
are inserted every "line length" characters in the string.

  • param string $string
  • return int number of bytes written
Methods
protected createStream() : Psr\Http\Message\StreamInterface
 

Implement in subclasses to dynamically create streams when requested.

  • throws \BadMethodCallException
Properties
private $lineEnding = NULL
 
  • var string The line ending characters to insert.
private $lineEndingLength = NULL
 
  • var int The strlen() of $lineEnding
private $lineLength = NULL
 
  • var int The number of characters in a line before inserting $lineEnding.
private $position = NULL
 
  • var int Number of bytes written, and importantly, if non-zero, writes a
    final $lineEnding on close (and so maintained instead of using
    tell() directly)
private $stream = NULL
 
  • var \StreamInterface $stream
Methods
private beforeClose() : void
 

Inserts a final line ending character.

private getChunkedString(string $string) : string
 

Inserts the line ending character after each line length characters in
the passed string, making sure previously written bytes are taken into
account.

© 2023 Bruce Wells
Search Namespaces \ Classes
Configuration