class Formatter

Utilities that are used for formatting queries.

Properties

array $options The formatting options.
static array $SHORT_CLAUSES Clauses that are usually short.
static array $INLINE_CLAUSES Clauses that must be inlined.

Methods

__construct(array $options = array())

Constructor.

array
getDefaultOptions()

The default formatting options.

array
getDefaultFormats()

The styles used for HTML formatting.

string
formatList(TokensList $list)

Formats the given list of tokens.

escapeConsole($string)

No description

string
toString(Token $token)

Tries to print the query and returns the result.

static string
format(string $query, array $options = array())

Formats a query.

static int
getGroupLength(TokensList $list)

Computes the length of a group.

static int|bool
isClause(Token $token)

Checks if a token is a statement or a clause inside a statement.

Details

at line 77
__construct(array $options = array())

Constructor.

Parameters

array $options the formatting options

at line 121
protected array getDefaultOptions()

The default formatting options.

Return Value

array

at line 183
protected array getDefaultFormats()

The styles used for HTML formatting.

array($type, $flags, $span, $callback).

Return Value

array

at line 287
string formatList(TokensList $list)

Formats the given list of tokens.

Parameters

TokensList $list the list of tokens

Return Value

string

at line 516
escapeConsole($string)

Parameters

$string

at line 538
string toString(Token $token)

Tries to print the query and returns the result.

Parameters

Token $token the token to be printed

Return Value

string

at line 593
static string format(string $query, array $options = array())

Formats a query.

Parameters

string $query The query to be formatted
array $options the formatting options

Return Value

string the formatted string

at line 610
static int getGroupLength(TokensList $list)

Computes the length of a group.

A group is delimited by a pair of brackets.

Parameters

TokensList $list the list of tokens

Return Value

int

at line 656
static int|bool isClause(Token $token)

Checks if a token is a statement or a clause inside a statement.

Parameters

Token $token the token to be checked

Return Value

int|bool