StringStream
in package
implements
Stream
FinalYes
Tags
Table of Contents
Interfaces
- Stream
- Represents an input stream. This allows us to have different types of input, each with their own optimizations.
Properties
Methods
- __construct() : mixed
- __toString() : string
- isEOF() : bool
- Test if the stream is at its end.
- position() : Position
- takeN() : TakeResult
- Try to extract a chunk of length $n, or if the stream is too short, the rest of the stream.
- takeWhile() : TakeResult
- Extract a chunk of the stream, by taking tokens as long as the predicate holds. Return the chunk and the rest of the stream.
Properties
$position
private
Position
$position
$string
private
string
$string
Methods
__construct()
public
__construct(string $string[, Position|null $position = null ]) : mixed
APIYes
Parameters
- $string : string
- $position : Position|null = null
__toString()
public
__toString() : string
Tags
Return values
stringisEOF()
Test if the stream is at its end.
public
isEOF() : bool
Tags
Return values
boolposition()
public
position() : Position
Tags
Return values
PositiontakeN()
Try to extract a chunk of length $n, or if the stream is too short, the rest of the stream.
public
takeN(int $n) : TakeResult
Parameters
- $n : int
Tags
Return values
TakeResulttakeWhile()
Extract a chunk of the stream, by taking tokens as long as the predicate holds. Return the chunk and the rest of the stream.
public
takeWhile(callable $predicate) : TakeResult
Parameters
- $predicate : callable