abstract class Component implements Stringable (View source)

Defines a component that is later extended to parse specialized components or keywords.

There is a small difference between Component and Keyword classes: usually, Component parsers can be reused in multiple situations and Keyword parsers count on the *Component classes to do their job.

A component (of a statement) is a part of a statement that is common to multiple query types.

Methods

static mixed
parse(Parser $parser, TokensList $list, array $options = [])

Parses the tokens contained in the given list in the context of the given parser.

static mixed
build(mixed $component, array $options = [])

Builds the string representation of a component of this type.

string
__toString()

Builds the string representation of a component of this type.

Details

static mixed parse(Parser $parser, TokensList $list, array $options = [])

Parses the tokens contained in the given list in the context of the given parser.

Parameters

Parser $parser

the parser that serves as context

TokensList $list

the list of tokens that are being parsed

array $options

parameters for parsing

Return Value

mixed

Exceptions

Exception

static mixed build(mixed $component, array $options = [])

Builds the string representation of a component of this type.

In other words, this function represents the inverse function of static::parse.

Parameters

mixed $component

the component to be built

array $options

parameters for building

Return Value

mixed

Exceptions

Exception

string __toString()

Builds the string representation of a component of this type.

Return Value

string

See also

static::build