class ImapTokenizer (View source)

Properties

protected int $position

The current position in the buffer.

protected string $buffer

The buffer of characters read from the stream.

Methods

__construct(StreamInterface $stream)

Constructor.

Token|null
nextToken()

Returns the next token from the stream.

void
skipWhitespace()

Skips whitespace characters (spaces and tabs only, preserving CRLF).

readQuotedString()

Reads a quoted string token.

readLiteral()

Reads a literal token.

readNumberOrAtom()

Reads a number or atom token.

readNumber()

Reads a number token.

readAtom()

Reads an atom token.

readEmailAddress()

Reads an email address token enclosed in angle brackets.

void
ensureBuffer(int $length)

Ensures that at least the given length in characters are available in the buffer.

string|null
currentChar()

Returns the current character in the buffer.

void
advance(int $n = 1)

Advances the internal pointer by $n characters.

void
flushBuffer()

Flush the buffer and reset the position.

bool
isValidAtomCharacter(string $char)

Determine if the given character is a valid atom character.

bool
isDelimiter(string $char)

Determine if the given character is a delimiter for tokenizing responses.

Details

__construct(StreamInterface $stream)

Constructor.

Parameters

StreamInterface $stream

Token|null nextToken()

Returns the next token from the stream.

Return Value

Token|null

protected void skipWhitespace()

Skips whitespace characters (spaces and tabs only, preserving CRLF).

Return Value

void

protected QuotedString readQuotedString()

Reads a quoted string token.

Quoted strings are enclosed in double quotes and may contain escaped characters.

Return Value

QuotedString

protected Literal readLiteral()

Reads a literal token.

Literal blocks in IMAP have the form {}\r\n.

Return Value

Literal

protected Token readNumberOrAtom()

Reads a number or atom token.

Return Value

Token

protected Number readNumber()

Reads a number token.

A number consists of one or more digit characters and represents a numeric value.

Return Value

Number

protected Atom readAtom()

Reads an atom token.

ATOMs are sequences of printable ASCII characters that do not contain delimiters.

Return Value

Atom

protected EmailAddress|null readEmailAddress()

Reads an email address token enclosed in angle brackets.

Email addresses are enclosed in angle brackets ("<" and ">").

For example "[email protected]"

Return Value

EmailAddress|null

protected void ensureBuffer(int $length)

Ensures that at least the given length in characters are available in the buffer.

Parameters

int $length

Return Value

void

protected string|null currentChar()

Returns the current character in the buffer.

Return Value

string|null

protected void advance(int $n = 1)

Advances the internal pointer by $n characters.

Parameters

int $n

Return Value

void

protected void flushBuffer()

Flush the buffer and reset the position.

Return Value

void

protected bool isValidAtomCharacter(string $char)

Determine if the given character is a valid atom character.

Parameters

string $char

Return Value

bool

protected bool isDelimiter(string $char)

Determine if the given character is a delimiter for tokenizing responses.

Parameters

string $char

Return Value

bool