@@ -267,75 +267,75 @@ |
||
267 | 267 | $fields = ''; |
268 | 268 | if (!empty($this->fields)) { |
269 | 269 | if (is_array($this->fields)) { |
270 | - $fields = CreateDefinition::build($this->fields) . ' '; |
|
270 | + $fields = CreateDefinition::build($this->fields).' '; |
|
271 | 271 | } elseif ($this->fields instanceof ArrayObj) { |
272 | 272 | $fields = ArrayObj::build($this->fields); |
273 | 273 | } |
274 | 274 | } |
275 | 275 | if ($this->options->has('DATABASE')) { |
276 | 276 | return 'CREATE ' |
277 | - . OptionsArray::build($this->options) . ' ' |
|
278 | - . Expression::build($this->name) . ' ' |
|
277 | + . OptionsArray::build($this->options).' ' |
|
278 | + . Expression::build($this->name).' ' |
|
279 | 279 | . OptionsArray::build($this->entityOptions); |
280 | 280 | } elseif ($this->options->has('TABLE') && !is_null($this->select)) { |
281 | 281 | return 'CREATE ' |
282 | - . OptionsArray::build($this->options) . ' ' |
|
283 | - . Expression::build($this->name) . ' ' |
|
282 | + . OptionsArray::build($this->options).' ' |
|
283 | + . Expression::build($this->name).' ' |
|
284 | 284 | . $this->select->build(); |
285 | 285 | } elseif ($this->options->has('TABLE')) { |
286 | 286 | $partition = ''; |
287 | 287 | |
288 | 288 | if (!empty($this->partitionBy)) { |
289 | - $partition .= "\nPARTITION BY " . $this->partitionBy; |
|
289 | + $partition .= "\nPARTITION BY ".$this->partitionBy; |
|
290 | 290 | } |
291 | 291 | if (!empty($this->partitionsNum)) { |
292 | - $partition .= "\nPARTITIONS " . $this->partitionsNum; |
|
292 | + $partition .= "\nPARTITIONS ".$this->partitionsNum; |
|
293 | 293 | } |
294 | 294 | if (!empty($this->subpartitionBy)) { |
295 | - $partition .= "\nSUBPARTITION BY " . $this->subpartitionBy; |
|
295 | + $partition .= "\nSUBPARTITION BY ".$this->subpartitionBy; |
|
296 | 296 | } |
297 | 297 | if (!empty($this->subpartitionsNum)) { |
298 | - $partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum; |
|
298 | + $partition .= "\nSUBPARTITIONS ".$this->subpartitionsNum; |
|
299 | 299 | } |
300 | 300 | if (!empty($this->partitions)) { |
301 | - $partition .= "\n" . PartitionDefinition::build($this->partitions); |
|
301 | + $partition .= "\n".PartitionDefinition::build($this->partitions); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | return 'CREATE ' |
305 | - . OptionsArray::build($this->options) . ' ' |
|
306 | - . Expression::build($this->name) . ' ' |
|
305 | + . OptionsArray::build($this->options).' ' |
|
306 | + . Expression::build($this->name).' ' |
|
307 | 307 | . $fields |
308 | 308 | . OptionsArray::build($this->entityOptions) |
309 | 309 | . $partition; |
310 | 310 | } elseif ($this->options->has('VIEW')) { |
311 | 311 | return 'CREATE ' |
312 | - . OptionsArray::build($this->options) . ' ' |
|
313 | - . Expression::build($this->name) . ' ' |
|
314 | - . $fields . ' AS ' . TokensList::build($this->body) . ' ' |
|
312 | + . OptionsArray::build($this->options).' ' |
|
313 | + . Expression::build($this->name).' ' |
|
314 | + . $fields.' AS '.TokensList::build($this->body).' ' |
|
315 | 315 | . OptionsArray::build($this->entityOptions); |
316 | 316 | } elseif ($this->options->has('TRIGGER')) { |
317 | 317 | return 'CREATE ' |
318 | - . OptionsArray::build($this->options) . ' ' |
|
319 | - . Expression::build($this->name) . ' ' |
|
320 | - . OptionsArray::build($this->entityOptions) . ' ' |
|
321 | - . 'ON ' . Expression::build($this->table) . ' ' |
|
322 | - . 'FOR EACH ROW ' . TokensList::build($this->body); |
|
318 | + . OptionsArray::build($this->options).' ' |
|
319 | + . Expression::build($this->name).' ' |
|
320 | + . OptionsArray::build($this->entityOptions).' ' |
|
321 | + . 'ON '.Expression::build($this->table).' ' |
|
322 | + . 'FOR EACH ROW '.TokensList::build($this->body); |
|
323 | 323 | } elseif (($this->options->has('PROCEDURE')) |
324 | 324 | || ($this->options->has('FUNCTION')) |
325 | 325 | ) { |
326 | 326 | $tmp = ''; |
327 | 327 | if ($this->options->has('FUNCTION')) { |
328 | - $tmp = 'RETURNS ' . DataType::build($this->return); |
|
328 | + $tmp = 'RETURNS '.DataType::build($this->return); |
|
329 | 329 | } |
330 | 330 | return 'CREATE ' |
331 | - . OptionsArray::build($this->options) . ' ' |
|
332 | - . Expression::build($this->name) . ' ' |
|
333 | - . ParameterDefinition::build($this->parameters) . ' ' |
|
334 | - . $tmp . ' ' . TokensList::build($this->body); |
|
331 | + . OptionsArray::build($this->options).' ' |
|
332 | + . Expression::build($this->name).' ' |
|
333 | + . ParameterDefinition::build($this->parameters).' ' |
|
334 | + . $tmp.' '.TokensList::build($this->body); |
|
335 | 335 | } |
336 | 336 | return 'CREATE ' |
337 | - . OptionsArray::build($this->options) . ' ' |
|
338 | - . Expression::build($this->name) . ' ' |
|
337 | + . OptionsArray::build($this->options).' ' |
|
338 | + . Expression::build($this->name).' ' |
|
339 | 339 | . TokensList::build($this->body); |
340 | 340 | } |
341 | 341 |
@@ -150,8 +150,8 @@ |
||
150 | 150 | $tmp[] = $altered::build($altered); |
151 | 151 | } |
152 | 152 | |
153 | - return 'ALTER ' . OptionsArray::build($this->options) |
|
154 | - . ' ' . Expression::build($this->table) |
|
155 | - . ' ' . implode(', ', $tmp); |
|
153 | + return 'ALTER '.OptionsArray::build($this->options) |
|
154 | + . ' '.Expression::build($this->table) |
|
155 | + . ' '.implode(', ', $tmp); |
|
156 | 156 | } |
157 | 157 | } |
@@ -86,8 +86,8 @@ |
||
86 | 86 | */ |
87 | 87 | public function build() |
88 | 88 | { |
89 | - return 'INSERT ' . $this->options |
|
90 | - . ' INTO ' . $this->into |
|
91 | - . ' VALUES ' . ArrayObj::build($this->values); |
|
89 | + return 'INSERT '.$this->options |
|
90 | + . ' INTO '.$this->into |
|
91 | + . ' VALUES '.ArrayObj::build($this->values); |
|
92 | 92 | } |
93 | 93 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | public function build() |
41 | 41 | { |
42 | 42 | // Building the parsed part of the query (if any). |
43 | - $query = parent::build() . ' '; |
|
43 | + $query = parent::build().' '; |
|
44 | 44 | |
45 | 45 | // Rebuilding the unknown part from tokens. |
46 | 46 | foreach ($this->unknown as $token) { |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @var int |
32 | 32 | */ |
33 | - const TYPE_BEGIN = 1; |
|
33 | + const TYPE_BEGIN = 1; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * COMMIT and ROLLBACK |
37 | 37 | * |
38 | 38 | * @var int |
39 | 39 | */ |
40 | - const TYPE_END = 2; |
|
40 | + const TYPE_END = 2; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * The type of this query. |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | /** |
112 | 112 | * @var SelectStatement $statement |
113 | 113 | */ |
114 | - $ret .= ';' . $statement->build(); |
|
114 | + $ret .= ';'.$statement->build(); |
|
115 | 115 | } |
116 | - $ret .= ';' . $this->end->build(); |
|
116 | + $ret .= ';'.$this->end->build(); |
|
117 | 117 | } |
118 | 118 | return $ret; |
119 | 119 | } |
@@ -175,12 +175,12 @@ |
||
175 | 175 | |
176 | 176 | // Checking if the name of the clause should be added. |
177 | 177 | if ($type & 2) { |
178 | - $query .= $name . ' '; |
|
178 | + $query .= $name.' '; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | // Checking if the result of the builder should be added. |
182 | 182 | if ($type & 1) { |
183 | - $query .= $class::build($this->$field) . ' '; |
|
183 | + $query .= $class::build($this->$field).' '; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 |
@@ -53,47 +53,47 @@ discard block |
||
53 | 53 | * @var string |
54 | 54 | */ |
55 | 55 | const TEMPLATE = |
56 | - '<?php' . "\n" . |
|
57 | - '' . "\n" . |
|
58 | - '/**' . "\n" . |
|
59 | - ' * Context for %1$s.' . "\n" . |
|
60 | - ' *' . "\n" . |
|
61 | - ' * This file was auto-generated.' . "\n" . |
|
62 | - ' *' . "\n" . |
|
63 | - ' * @package SqlParser' . "\n" . |
|
64 | - ' * @subpackage Contexts' . "\n" . |
|
65 | - ' * @link %3$s' . "\n" . |
|
66 | - ' */' . "\n" . |
|
67 | - 'namespace SqlParser\\Contexts;' . "\n" . |
|
68 | - '' . "\n" . |
|
69 | - 'use SqlParser\\Context;' . "\n" . |
|
70 | - '' . "\n" . |
|
71 | - '/**' . "\n" . |
|
72 | - ' * Context for %1$s.' . "\n" . |
|
73 | - ' *' . "\n" . |
|
74 | - ' * @category Contexts' . "\n" . |
|
75 | - ' * @package SqlParser' . "\n" . |
|
76 | - ' * @subpackage Contexts' . "\n" . |
|
77 | - ' * @author Dan Ungureanu <[email protected]>' . "\n" . |
|
78 | - ' * @license http://opensource.org/licenses/GPL-2.0 GNU Public License' . "\n" . |
|
79 | - ' */' . "\n" . |
|
80 | - 'class %2$s extends Context' . "\n" . |
|
81 | - '{' . "\n" . |
|
82 | - '' . "\n" . |
|
83 | - ' /**' . "\n" . |
|
84 | - ' * List of keywords.' . "\n" . |
|
85 | - ' *' . "\n" . |
|
86 | - ' * The value associated to each keyword represents its flags.' . "\n" . |
|
87 | - ' *' . "\n" . |
|
88 | - ' * @see Token::FLAG_KEYWORD_*' . "\n" . |
|
89 | - ' *' . "\n" . |
|
90 | - ' * @var array' . "\n" . |
|
91 | - ' */' . "\n" . |
|
92 | - ' public static $KEYWORDS = array(' . "\n" . |
|
93 | - '' . "\n" . |
|
94 | - '%4$s' . |
|
95 | - ' );' . "\n" . |
|
96 | - '}' . "\n"; |
|
56 | + '<?php'."\n". |
|
57 | + ''."\n". |
|
58 | + '/**'."\n". |
|
59 | + ' * Context for %1$s.'."\n". |
|
60 | + ' *'."\n". |
|
61 | + ' * This file was auto-generated.'."\n". |
|
62 | + ' *'."\n". |
|
63 | + ' * @package SqlParser'."\n". |
|
64 | + ' * @subpackage Contexts'."\n". |
|
65 | + ' * @link %3$s'."\n". |
|
66 | + ' */'."\n". |
|
67 | + 'namespace SqlParser\\Contexts;'."\n". |
|
68 | + ''."\n". |
|
69 | + 'use SqlParser\\Context;'."\n". |
|
70 | + ''."\n". |
|
71 | + '/**'."\n". |
|
72 | + ' * Context for %1$s.'."\n". |
|
73 | + ' *'."\n". |
|
74 | + ' * @category Contexts'."\n". |
|
75 | + ' * @package SqlParser'."\n". |
|
76 | + ' * @subpackage Contexts'."\n". |
|
77 | + ' * @author Dan Ungureanu <[email protected]>'."\n". |
|
78 | + ' * @license http://opensource.org/licenses/GPL-2.0 GNU Public License'."\n". |
|
79 | + ' */'."\n". |
|
80 | + 'class %2$s extends Context'."\n". |
|
81 | + '{'."\n". |
|
82 | + ''."\n". |
|
83 | + ' /**'."\n". |
|
84 | + ' * List of keywords.'."\n". |
|
85 | + ' *'."\n". |
|
86 | + ' * The value associated to each keyword represents its flags.'."\n". |
|
87 | + ' *'."\n". |
|
88 | + ' * @see Token::FLAG_KEYWORD_*'."\n". |
|
89 | + ' *'."\n". |
|
90 | + ' * @var array'."\n". |
|
91 | + ' */'."\n". |
|
92 | + ' public static $KEYWORDS = array('."\n". |
|
93 | + ''."\n". |
|
94 | + '%4$s'. |
|
95 | + ' );'."\n". |
|
96 | + '}'."\n"; |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Sorts an array of words. |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | if ($i == 0) { |
199 | 199 | $ret .= str_repeat(' ', $spaces); |
200 | 200 | } |
201 | - $ret .= "'" . $word . "' => " . $type . ', '; |
|
201 | + $ret .= "'".$word."' => ".$type.', '; |
|
202 | 202 | if (++$i == $count) { |
203 | 203 | $ret .= "\n"; |
204 | 204 | $i = 0; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @var string |
261 | 261 | */ |
262 | - $directory = dirname($input) . '/'; |
|
262 | + $directory = dirname($input).'/'; |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * The name of the file that contains the context. |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @var string |
282 | 282 | */ |
283 | - $class = 'Context' . $name; |
|
283 | + $class = 'Context'.$name; |
|
284 | 284 | |
285 | 285 | /** |
286 | 286 | * The formatted name of this context. |
@@ -288,13 +288,13 @@ discard block |
||
288 | 288 | * @var string |
289 | 289 | */ |
290 | 290 | $formattedName = str_replace( |
291 | - array('Context', 'MySql', '00', '0'), |
|
292 | - array('', 'MySQL ', '', '.'), |
|
291 | + array('Context', 'MySql', '00', '0'), |
|
292 | + array('', 'MySQL ', '', '.'), |
|
293 | 293 | $class |
294 | 294 | ); |
295 | 295 | |
296 | 296 | file_put_contents( |
297 | - $output . '/' . $class . '.php', |
|
297 | + $output.'/'.$class.'.php', |
|
298 | 298 | static::generate( |
299 | 299 | array( |
300 | 300 | 'name' => $formattedName, |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | 'link' => static::$LINKS[$name], |
303 | 303 | 'keywords' => static::readWords( |
304 | 304 | array( |
305 | - $directory . '_common.txt', |
|
306 | - $directory . '_functions' . $file, |
|
307 | - $directory . $file |
|
305 | + $directory.'_common.txt', |
|
306 | + $directory.'_functions'.$file, |
|
307 | + $directory.$file |
|
308 | 308 | ) |
309 | 309 | ), |
310 | 310 | ) |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | // Building the context. |
334 | 334 | sprintf("Building context for %s...\n", $file); |
335 | - static::build($input . '/' . $file, $output); |
|
335 | + static::build($input.'/'.$file, $output); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | // Appending the filename to directories. |
155 | - $inputFile = $input . '/' . $file; |
|
156 | - $outputFile = $output . '/' . $file; |
|
157 | - $debugFile = ($debug !== null) ? $debug . '/' . $file : null; |
|
155 | + $inputFile = $input.'/'.$file; |
|
156 | + $outputFile = $output.'/'.$file; |
|
157 | + $debugFile = ($debug !== null) ? $debug.'/'.$file : null; |
|
158 | 158 | |
159 | 159 | if (is_dir($inputFile)) { |
160 | 160 | // Creating required directories to maintain the structure. |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | } elseif (substr($inputFile, -3) === '.in') { |
172 | 172 | // Generating file names by replacing `.in` with `.out` and |
173 | 173 | // `.debug`. |
174 | - $outputFile = substr($outputFile, 0, -3) . '.out'; |
|
174 | + $outputFile = substr($outputFile, 0, -3).'.out'; |
|
175 | 175 | if ($debug !== null) { |
176 | - $debugFile = substr($debugFile, 0, -3) . '.debug'; |
|
176 | + $debugFile = substr($debugFile, 0, -3).'.debug'; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | // Building the test. |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $ret->subquery = $token->value; |
229 | 229 | } elseif (($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
230 | 230 | && (empty($options['parseField']) |
231 | - && ! $alias) |
|
231 | + && !$alias) |
|
232 | 232 | ) { |
233 | 233 | $isExpr = true; |
234 | 234 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | continue; |
256 | 256 | } |
257 | 257 | $isExpr = true; |
258 | - } elseif ($brackets === 0 && count($ret->expr) > 0 && ! $alias) { |
|
258 | + } elseif ($brackets === 0 && count($ret->expr) > 0 && !$alias) { |
|
259 | 259 | /* End of expression */ |
260 | 260 | break; |
261 | 261 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | } |
434 | 434 | |
435 | 435 | if (!empty($component->alias)) { |
436 | - $ret .= ' AS ' . Context::escape($component->alias); |
|
436 | + $ret .= ' AS '.Context::escape($component->alias); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | return $ret; |