SqlFormatter
in package
FinalYes
Table of Contents
Properties
- $highlighter : Highlighter
- $tokenizer : Tokenizer
Methods
- __construct() : mixed
- compress() : string
- Compress a query by collapsing white space and removing comments
- format() : string
- Format the whitespace in a SQL string to make it easier to read.
- highlight() : string
- Add syntax highlighting to a SQL string
Properties
$highlighter
private
Highlighter
$highlighter
$tokenizer
private
Tokenizer
$tokenizer
Methods
__construct()
public
__construct([Highlighter|null $highlighter = null ]) : mixed
Parameters
- $highlighter : Highlighter|null = null
compress()
Compress a query by collapsing white space and removing comments
public
compress(string $string) : string
Parameters
- $string : string
-
The SQL string
Return values
string —The SQL string without comments
format()
Format the whitespace in a SQL string to make it easier to read.
public
format(string $string[, string $indentString = ' ' ]) : string
Parameters
- $string : string
-
The SQL string
- $indentString : string = ' '
Return values
string —The SQL string with HTML styles and formatting wrapped in a
tag
highlight()
Add syntax highlighting to a SQL string
public
highlight(string $string) : string
Parameters
- $string : string
-
The SQL string
Return values
string —The SQL string with HTML styles applied