PHP Класс SqlParser\Utils\Formatter

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$INLINE_CLAUSES array These clauses usually are short and it's nicer to have them inline.
$options array The formatting options.

Открытые методы

Метод Описание
__construct ( array $options = [] ) Constructor.
escapeConsole ( $string )
format ( string $query, array $options = [] ) : string Formats a query.
formatList ( TokensList $list ) : string Formats the given list of tokens.
getGroupLength ( TokensList $list ) : integer Computes the length of a group.
isClause ( Token $token ) : integer | boolean Checks if a token is a statement or a clause inside a statement.
toString ( Token $token ) : string Tries to print the query and returns the result.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( array $options = [] )
$options array The formatting options.

escapeConsole() публичный Метод

public escapeConsole ( $string )

format() публичный статический Метод

Formats a query.
public static format ( string $query, array $options = [] ) : string
$query string The query to be formatted
$options array The formatting options.
Результат string The formatted string.

formatList() публичный Метод

Formats the given list of tokens.
public formatList ( TokensList $list ) : string
$list SqlParser\TokensList The list of tokens.
Результат string

getGroupLength() публичный статический Метод

A group is delimited by a pair of brackets.
public static getGroupLength ( TokensList $list ) : integer
$list SqlParser\TokensList The list of tokens.
Результат integer

isClause() публичный статический Метод

Checks if a token is a statement or a clause inside a statement.
public static isClause ( Token $token ) : integer | boolean
$token SqlParser\Token The token to be checked.
Результат integer | boolean

toString() публичный Метод

Tries to print the query and returns the result.
public toString ( Token $token ) : string
$token SqlParser\Token The token to be printed.
Результат string

Описание свойств

$INLINE_CLAUSES публичное статическое свойство

These clauses usually are short and it's nicer to have them inline.
public static array $INLINE_CLAUSES
Результат array

$options публичное свойство

The formatting options.
public array $options
Результат array