PHP Class SqlParser\Utils\Formatter

Afficher le fichier Open project: phpmyadmin/sql-parser Class Usage Examples

Méthodes publiques

Свойство Type Description
$INLINE_CLAUSES array These clauses usually are short and it's nicer to have them inline.
$options array The formatting options.

Méthodes publiques

Méthode Description
__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.

Method Details

__construct() public méthode

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

escapeConsole() public méthode

public escapeConsole ( $string )

format() public static méthode

Formats a query.
public static format ( string $query, array $options = [] ) : string
$query string The query to be formatted
$options array The formatting options.
Résultat string The formatted string.

formatList() public méthode

Formats the given list of tokens.
public formatList ( TokensList $list ) : string
$list SqlParser\TokensList The list of tokens.
Résultat string

getGroupLength() public static méthode

A group is delimited by a pair of brackets.
public static getGroupLength ( TokensList $list ) : integer
$list SqlParser\TokensList The list of tokens.
Résultat integer

isClause() public static méthode

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.
Résultat integer | boolean

toString() public méthode

Tries to print the query and returns the result.
public toString ( Token $token ) : string
$token SqlParser\Token The token to be printed.
Résultat string

Property Details

$INLINE_CLAUSES public_oe static_oe property

These clauses usually are short and it's nicer to have them inline.
public static array $INLINE_CLAUSES
Résultat array

$options public_oe property

The formatting options.
public array $options
Résultat array