Documentation

Parser
in package

Table of Contents

Properties

$bufferLength  : int
$buffers  : array<int, string>
$delimiter  : int|string|null
$generator  : Generator<string, void>|null

Methods

__construct()  : mixed
cancel()  : string
Cancels the generator parser and returns any remaining data in the internal buffer. Writing data after calling this method will result in an error.
isValid()  : bool
push()  : void
Adds data to the internal buffer and tries to continue parsing.
filterDelimiter()  : int|string|null

Properties

$bufferLength

private int $bufferLength = 0

$buffers

private array<int, string> $buffers = []

$delimiter

private int|string|null $delimiter

$generator

private Generator<string, void>|null $generator

Methods

__construct()

public __construct(Generator<string, void> $generator) : mixed
Parameters
$generator : Generator<string, void>
Tags
throws
InvalidDelimiterError

If the generator yields an invalid delimiter.

throws
Throwable

If the generator throws.

cancel()

Cancels the generator parser and returns any remaining data in the internal buffer. Writing data after calling this method will result in an error.

public final cancel() : string
Return values
string

isValid()

public final isValid() : bool
Return values
bool

True if the parser can still receive more data to parse, false if it has ended and calling push will throw an exception.

push()

Adds data to the internal buffer and tries to continue parsing.

public final push(string $data) : void
Parameters
$data : string

Data to append to the internal buffer.

Tags
throws
InvalidDelimiterError

If the generator yields an invalid delimiter.

throws
Error

If parsing has already been cancelled.

throws
Throwable

If the generator throws.

filterDelimiter()

private filterDelimiter(mixed $delimiter) : int|string|null
Parameters
$delimiter : mixed

Value yielded from Generator.

Return values
int|string|null

        
On this page

Search results