class ImapParser (View source)

Properties

protected Token|null $currentToken

The current token being parsed.

Methods

__construct(ImapTokenizer $tokenizer)

Constructor.

next()

Get the next response from the tokenizer.

parseUntaggedResponse()

Parse an untagged response.

parseContinuationResponse()

Parse a continuation response.

parseTaggedResponse()

Parse a tagged response.

parseBracketGroup()

Parses a bracket group of elements delimited by '[' and ']'.

parseList()

Parses a list of elements delimited by '(' and ')'.

Data|Token|null
parseElement()

Parses a single element, which might be a list or a simple token.

void
advance()

Advance to the next token from the tokenizer.

Details

__construct(ImapTokenizer $tokenizer)

Constructor.

Parameters

ImapTokenizer $tokenizer

Data|Token|Response|null next()

Get the next response from the tokenizer.

Return Value

Data|Token|Response|null

protected UntaggedResponse parseUntaggedResponse()

Parse an untagged response.

An untagged response begins with the '*' token. It may contain multiple elements, including lists and response codes.

Return Value

UntaggedResponse

protected ContinuationResponse parseContinuationResponse()

Parse a continuation response.

A continuation response starts with a '+' token, indicating that the server expects additional data from the client.

Return Value

ContinuationResponse

protected TaggedResponse parseTaggedResponse()

Parse a tagged response.

A tagged response begins with a tag (which is not '*' or '+') and is followed by a status and optional data.

Return Value

TaggedResponse

protected ResponseCodeData parseBracketGroup()

Parses a bracket group of elements delimited by '[' and ']'.

Bracket groups are used to represent response codes.

Return Value

ResponseCodeData

protected ListData parseList()

Parses a list of elements delimited by '(' and ')'.

Lists are handled recursively, as a list may contain nested lists.

Return Value

ListData

protected Data|Token|null parseElement()

Parses a single element, which might be a list or a simple token.

Return Value

Data|Token|null

protected void advance()

Advance to the next token from the tokenizer.

Return Value

void