SqlParser\Utils\Formatter::format PHP Method

format() public static method

Formats a query.
public static format ( string $query, array $options = [] ) : string
$query string The query to be formatted
$options array The formatting options.
return string The formatted string.
    public static function format($query, array $options = array())
    {
        $lexer = new Lexer($query);
        $formatter = new Formatter($options);
        return $formatter->formatList($lexer->list);
    }

Usage Example

Example #1
0
 public function runHighlight()
 {
     $params = $this->parseHighlight();
     if ($params === false) {
         return 1;
     }
     if (isset($params['h'])) {
         $this->usageHighlight();
         return 0;
     }
     if (isset($params['q'])) {
         echo Formatter::format($params['q'], array('type' => $params['f']));
         echo "\n";
         return 0;
     }
     echo "ERROR: Missing parameters!\n";
     $this->usageHighlight();
     return 1;
 }
All Usage Examples Of SqlParser\Utils\Formatter::format