@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | // We have reached the end of ALTER operation and suddenly found |
224 | 224 | // a start to new statement, but have not find a delimiter between them |
225 | 225 | |
226 | - if (! ($token->value == 'SET' && $list->tokens[$list->idx - 1]->value == 'CHARACTER')) { |
|
226 | + if (!($token->value == 'SET' && $list->tokens[$list->idx - 1]->value == 'CHARACTER')) { |
|
227 | 227 | $parser->error( |
228 | 228 | __('A new statement was found, but no delimiter between it and the previous one.'), |
229 | 229 | $token |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public static function build($component, array $options = array()) |
257 | 257 | { |
258 | - $ret = $component->options . ' '; |
|
258 | + $ret = $component->options.' '; |
|
259 | 259 | if ((isset($component->field)) && ($component->field !== '')) { |
260 | - $ret .= $component->field . ' '; |
|
260 | + $ret .= $component->field.' '; |
|
261 | 261 | } |
262 | 262 | $ret .= TokensList::build($component->unknown); |
263 | 263 | return $ret; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @var array |
33 | 33 | */ |
34 | 34 | public static $CLAUSES = array( |
35 | - 'SET' => array('SET', 3), |
|
35 | + 'SET' => array('SET', 3), |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function build() |
68 | 68 | { |
69 | - return 'SET ' . OptionsArray::build($this->options) |
|
70 | - . ' ' . SetOperation::build($this->set); |
|
69 | + return 'SET '.OptionsArray::build($this->options) |
|
70 | + . ' '.SetOperation::build($this->set); |
|
71 | 71 | } |
72 | 72 | } |
@@ -115,19 +115,19 @@ |
||
115 | 115 | */ |
116 | 116 | public function build() |
117 | 117 | { |
118 | - $ret = 'INSERT ' . $this->options |
|
119 | - . ' INTO ' . $this->into; |
|
118 | + $ret = 'INSERT '.$this->options |
|
119 | + . ' INTO '.$this->into; |
|
120 | 120 | |
121 | 121 | if ($this->values != NULL && count($this->values) > 0) { |
122 | - $ret .= ' VALUES ' . Array2d::build($this->values); |
|
122 | + $ret .= ' VALUES '.Array2d::build($this->values); |
|
123 | 123 | } elseif ($this->set != NULL && count($this->set) > 0) { |
124 | - $ret .= ' SET ' . SetOperation::build($this->set); |
|
124 | + $ret .= ' SET '.SetOperation::build($this->set); |
|
125 | 125 | } elseif ($this->select != NULL && count($this->select) > 0) { |
126 | - $ret .= ' ' . $this->select->build(); |
|
126 | + $ret .= ' '.$this->select->build(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if ($this->onDuplicateSet != NULL && count($this->onDuplicateSet) > 0) { |
130 | - $ret .= ' ON DUPLICATE KEY UPDATE ' . SetOperation::build($this->onDuplicateSet); |
|
130 | + $ret .= ' ON DUPLICATE KEY UPDATE '.SetOperation::build($this->onDuplicateSet); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $ret; |
@@ -93,15 +93,15 @@ |
||
93 | 93 | */ |
94 | 94 | public function build() |
95 | 95 | { |
96 | - $ret = 'REPLACE ' . $this->options |
|
97 | - . ' INTO ' . $this->into; |
|
96 | + $ret = 'REPLACE '.$this->options |
|
97 | + . ' INTO '.$this->into; |
|
98 | 98 | |
99 | 99 | if ($this->values != NULL && count($this->values) > 0) { |
100 | - $ret .= ' VALUES ' . Array2d::build($this->values); |
|
100 | + $ret .= ' VALUES '.Array2d::build($this->values); |
|
101 | 101 | } elseif ($this->set != NULL && count($this->set) > 0) { |
102 | - $ret .= ' SET ' . SetOperation::build($this->set); |
|
102 | + $ret .= ' SET '.SetOperation::build($this->set); |
|
103 | 103 | } elseif ($this->select != NULL && count($this->select) > 0) { |
104 | - $ret .= ' ' . $this->select->build(); |
|
104 | + $ret .= ' '.$this->select->build(); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $ret; |
@@ -183,7 +183,7 @@ |
||
183 | 183 | 'value' => '', |
184 | 184 | ); |
185 | 185 | $state = 1; |
186 | - } elseif ($lastOption[1] === 'expr' || $lastOption[1] === 'expr=') { |
|
186 | + } elseif ($lastOption[1] === 'expr' || $lastOption[1] === 'expr=') { |
|
187 | 187 | // This is a keyword that is followed by an expression. |
188 | 188 | // The expression is used by the specialized parser. |
189 | 189 |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | // pieces only if the clause is not inlined or this fragment |
351 | 351 | // is between brackets that are on new line. |
352 | 352 | if (((empty(self::$INLINE_CLAUSES[$lastClause])) |
353 | - && ! $shortGroup |
|
353 | + && !$shortGroup |
|
354 | 354 | && ($this->options['parts_newline'])) |
355 | 355 | || (end($blocksLineEndings) === true) |
356 | 356 | ) { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | } |
425 | 425 | |
426 | 426 | if ($this->options['type'] === 'cli') { |
427 | - return $ret . "\x1b[0m"; |
|
427 | + return $ret."\x1b[0m"; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | return $ret; |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | array( |
437 | 437 | "\x00", "\x01", "\x02", "\x03", "\x04", |
438 | 438 | "\x05", "\x06", "\x07", "\x08", "\x09", "\x0A", |
439 | - "\x0B","\x0C","\x0D", "\x0E", "\x0F", "\x10", "\x11", |
|
440 | - "\x12","\x13","\x14","\x15", "\x16", "\x17", "\x18", |
|
441 | - "\x19","\x1A","\x1B","\x1C","\x1D", "\x1E", "\x1F" |
|
439 | + "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", |
|
440 | + "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", |
|
441 | + "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x1E", "\x1F" |
|
442 | 442 | ), |
443 | 443 | array( |
444 | 444 | '\x00', '\x01', '\x02', '\x03', '\x04', |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | |
475 | 475 | // Formatting HTML. |
476 | 476 | if ($this->options['type'] === 'html') { |
477 | - return '<span ' . $format['html'] . '>' . htmlspecialchars($text, ENT_NOQUOTES) . '</span>'; |
|
477 | + return '<span '.$format['html'].'>'.htmlspecialchars($text, ENT_NOQUOTES).'</span>'; |
|
478 | 478 | } elseif ($this->options['type'] === 'cli') { |
479 | - return $format['cli'] . $this->escapeConsole($text); |
|
479 | + return $format['cli'].$this->escapeConsole($text); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | break; |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | } |
485 | 485 | |
486 | 486 | if ($this->options['type'] === 'cli') { |
487 | - return "\x1b[39m" . $this->escapeConsole($text); |
|
487 | + return "\x1b[39m".$this->escapeConsole($text); |
|
488 | 488 | } elseif ($this->options['type'] === 'html') { |
489 | 489 | return htmlspecialchars($text, ENT_NOQUOTES); |
490 | 490 | } |
@@ -52,46 +52,46 @@ discard block |
||
52 | 52 | * @var string |
53 | 53 | */ |
54 | 54 | const TEMPLATE = |
55 | - '<?php' . "\n" . |
|
56 | - '' . "\n" . |
|
57 | - '/**' . "\n" . |
|
58 | - ' * Context for %1$s.' . "\n" . |
|
59 | - ' *' . "\n" . |
|
60 | - ' * This file was auto-generated.' . "\n" . |
|
61 | - ' *' . "\n" . |
|
62 | - ' * @package SqlParser' . "\n" . |
|
63 | - ' * @subpackage Contexts' . "\n" . |
|
64 | - ' * @link %3$s' . "\n" . |
|
65 | - ' */' . "\n" . |
|
66 | - 'namespace SqlParser\\Contexts;' . "\n" . |
|
67 | - '' . "\n" . |
|
68 | - 'use SqlParser\\Context;' . "\n" . |
|
69 | - '' . "\n" . |
|
70 | - '/**' . "\n" . |
|
71 | - ' * Context for %1$s.' . "\n" . |
|
72 | - ' *' . "\n" . |
|
73 | - ' * @category Contexts' . "\n" . |
|
74 | - ' * @package SqlParser' . "\n" . |
|
75 | - ' * @subpackage Contexts' . "\n" . |
|
76 | - ' * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+' . "\n" . |
|
77 | - ' */' . "\n" . |
|
78 | - 'class %2$s extends Context' . "\n" . |
|
79 | - '{' . "\n" . |
|
80 | - '' . "\n" . |
|
81 | - ' /**' . "\n" . |
|
82 | - ' * List of keywords.' . "\n" . |
|
83 | - ' *' . "\n" . |
|
84 | - ' * The value associated to each keyword represents its flags.' . "\n" . |
|
85 | - ' *' . "\n" . |
|
86 | - ' * @see Token::FLAG_KEYWORD_*' . "\n" . |
|
87 | - ' *' . "\n" . |
|
88 | - ' * @var array' . "\n" . |
|
89 | - ' */' . "\n" . |
|
90 | - ' public static $KEYWORDS = array(' . "\n" . |
|
91 | - '' . "\n" . |
|
92 | - '%4$s' . |
|
93 | - ' );' . "\n" . |
|
94 | - '}' . "\n"; |
|
55 | + '<?php'."\n". |
|
56 | + ''."\n". |
|
57 | + '/**'."\n". |
|
58 | + ' * Context for %1$s.'."\n". |
|
59 | + ' *'."\n". |
|
60 | + ' * This file was auto-generated.'."\n". |
|
61 | + ' *'."\n". |
|
62 | + ' * @package SqlParser'."\n". |
|
63 | + ' * @subpackage Contexts'."\n". |
|
64 | + ' * @link %3$s'."\n". |
|
65 | + ' */'."\n". |
|
66 | + 'namespace SqlParser\\Contexts;'."\n". |
|
67 | + ''."\n". |
|
68 | + 'use SqlParser\\Context;'."\n". |
|
69 | + ''."\n". |
|
70 | + '/**'."\n". |
|
71 | + ' * Context for %1$s.'."\n". |
|
72 | + ' *'."\n". |
|
73 | + ' * @category Contexts'."\n". |
|
74 | + ' * @package SqlParser'."\n". |
|
75 | + ' * @subpackage Contexts'."\n". |
|
76 | + ' * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+'."\n". |
|
77 | + ' */'."\n". |
|
78 | + 'class %2$s extends Context'."\n". |
|
79 | + '{'."\n". |
|
80 | + ''."\n". |
|
81 | + ' /**'."\n". |
|
82 | + ' * List of keywords.'."\n". |
|
83 | + ' *'."\n". |
|
84 | + ' * The value associated to each keyword represents its flags.'."\n". |
|
85 | + ' *'."\n". |
|
86 | + ' * @see Token::FLAG_KEYWORD_*'."\n". |
|
87 | + ' *'."\n". |
|
88 | + ' * @var array'."\n". |
|
89 | + ' */'."\n". |
|
90 | + ' public static $KEYWORDS = array('."\n". |
|
91 | + ''."\n". |
|
92 | + '%4$s'. |
|
93 | + ' );'."\n". |
|
94 | + '}'."\n"; |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Sorts an array of words. |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if ($i == 0) { |
197 | 197 | $ret .= str_repeat(' ', $spaces); |
198 | 198 | } |
199 | - $ret .= "'" . $word . "' => " . $type . ', '; |
|
199 | + $ret .= "'".$word."' => ".$type.', '; |
|
200 | 200 | if (++$i == $count) { |
201 | 201 | $ret .= "\n"; |
202 | 202 | $i = 0; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @var string |
259 | 259 | */ |
260 | - $directory = dirname($input) . '/'; |
|
260 | + $directory = dirname($input).'/'; |
|
261 | 261 | |
262 | 262 | /** |
263 | 263 | * The name of the file that contains the context. |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @var string |
280 | 280 | */ |
281 | - $class = 'Context' . $name; |
|
281 | + $class = 'Context'.$name; |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * The formatted name of this context. |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | * @var string |
287 | 287 | */ |
288 | 288 | $formattedName = str_replace( |
289 | - array('Context', 'MySql', '00', '0'), |
|
290 | - array('', 'MySQL ', '', '.'), |
|
289 | + array('Context', 'MySql', '00', '0'), |
|
290 | + array('', 'MySQL ', '', '.'), |
|
291 | 291 | $class |
292 | 292 | ); |
293 | 293 | |
294 | 294 | file_put_contents( |
295 | - $output . '/' . $class . '.php', |
|
295 | + $output.'/'.$class.'.php', |
|
296 | 296 | static::generate( |
297 | 297 | array( |
298 | 298 | 'name' => $formattedName, |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | 'link' => static::$LINKS[$name], |
301 | 301 | 'keywords' => static::readWords( |
302 | 302 | array( |
303 | - $directory . '_common.txt', |
|
304 | - $directory . '_functions' . $file, |
|
305 | - $directory . $file |
|
303 | + $directory.'_common.txt', |
|
304 | + $directory.'_functions'.$file, |
|
305 | + $directory.$file |
|
306 | 306 | ) |
307 | 307 | ), |
308 | 308 | ) |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | // Building the context. |
332 | 332 | sprintf("Building context for %s...\n", $file); |
333 | - static::build($input . '/' . $file, $output); |
|
333 | + static::build($input.'/'.$file, $output); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | } |
@@ -82,30 +82,30 @@ |
||
82 | 82 | * @var array |
83 | 83 | */ |
84 | 84 | public static $CLAUSES = array( |
85 | - 'SELECT' => array('SELECT', 2), |
|
85 | + 'SELECT' => array('SELECT', 2), |
|
86 | 86 | // Used for options. |
87 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
87 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
88 | 88 | // Used for selected expressions. |
89 | - '_SELECT' => array('SELECT', 1), |
|
90 | - 'INTO' => array('INTO', 3), |
|
91 | - 'FROM' => array('FROM', 3), |
|
92 | - 'PARTITION' => array('PARTITION', 3), |
|
93 | - |
|
94 | - 'JOIN' => array('JOIN', 1), |
|
95 | - 'FULL JOIN' => array('FULL JOIN', 1), |
|
96 | - 'INNER JOIN' => array('INNER JOIN', 1), |
|
97 | - 'LEFT JOIN' => array('LEFT JOIN', 1), |
|
98 | - 'LEFT OUTER JOIN' => array('LEFT OUTER JOIN', 1), |
|
99 | - 'RIGHT JOIN' => array('RIGHT JOIN', 1), |
|
100 | - 'RIGHT OUTER JOIN' => array('RIGHT OUTER JOIN', 1), |
|
101 | - |
|
102 | - 'WHERE' => array('WHERE', 3), |
|
103 | - 'GROUP BY' => array('GROUP BY', 3), |
|
104 | - 'HAVING' => array('HAVING', 3), |
|
105 | - 'ORDER BY' => array('ORDER BY', 3), |
|
106 | - 'LIMIT' => array('LIMIT', 3), |
|
107 | - 'PROCEDURE' => array('PROCEDURE', 3), |
|
108 | - 'UNION' => array('UNION', 1), |
|
89 | + '_SELECT' => array('SELECT', 1), |
|
90 | + 'INTO' => array('INTO', 3), |
|
91 | + 'FROM' => array('FROM', 3), |
|
92 | + 'PARTITION' => array('PARTITION', 3), |
|
93 | + |
|
94 | + 'JOIN' => array('JOIN', 1), |
|
95 | + 'FULL JOIN' => array('FULL JOIN', 1), |
|
96 | + 'INNER JOIN' => array('INNER JOIN', 1), |
|
97 | + 'LEFT JOIN' => array('LEFT JOIN', 1), |
|
98 | + 'LEFT OUTER JOIN' => array('LEFT OUTER JOIN', 1), |
|
99 | + 'RIGHT JOIN' => array('RIGHT JOIN', 1), |
|
100 | + 'RIGHT OUTER JOIN' => array('RIGHT OUTER JOIN', 1), |
|
101 | + |
|
102 | + 'WHERE' => array('WHERE', 3), |
|
103 | + 'GROUP BY' => array('GROUP BY', 3), |
|
104 | + 'HAVING' => array('HAVING', 3), |
|
105 | + 'ORDER BY' => array('ORDER BY', 3), |
|
106 | + 'LIMIT' => array('LIMIT', 3), |
|
107 | + 'PROCEDURE' => array('PROCEDURE', 3), |
|
108 | + 'UNION' => array('UNION', 1), |
|
109 | 109 | // These are available only when `UNION` is present. |
110 | 110 | // 'ORDER BY' => array('ORDER BY', 3), |
111 | 111 | // 'LIMIT' => array('LIMIT', 3), |
@@ -141,12 +141,12 @@ |
||
141 | 141 | { |
142 | 142 | if ($component->dest instanceof Expression) { |
143 | 143 | $columns = !empty($component->columns) ? |
144 | - '(`' . implode('`, `', $component->columns) . '`)' : ''; |
|
145 | - return $component->dest . $columns; |
|
146 | - } elseif (! empty($component->variables)) { |
|
147 | - return ' ' . implode(', ', $component->variables); |
|
144 | + '(`'.implode('`, `', $component->columns).'`)' : ''; |
|
145 | + return $component->dest.$columns; |
|
146 | + } elseif (!empty($component->variables)) { |
|
147 | + return ' '.implode(', ', $component->variables); |
|
148 | 148 | } else { |
149 | - return 'OUTFILE "' . $component->dest . '"'; |
|
149 | + return 'OUTFILE "'.$component->dest.'"'; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | } |