@@ -114,6 +114,6 @@ |
||
| 114 | 114 | */ |
| 115 | 115 | public static function build($component, array $options = array()) |
| 116 | 116 | { |
| 117 | - return $component->name.$component->parameters; |
|
| 117 | + return $component->name . $component->parameters; |
|
| 118 | 118 | } |
| 119 | 119 | } |
@@ -251,9 +251,9 @@ |
||
| 251 | 251 | */ |
| 252 | 252 | public static function build($component, array $options = array()) |
| 253 | 253 | { |
| 254 | - $ret = $component->options.' '; |
|
| 254 | + $ret = $component->options . ' '; |
|
| 255 | 255 | if ((isset($component->field)) && ($component->field !== '')) { |
| 256 | - $ret .= $component->field.' '; |
|
| 256 | + $ret .= $component->field . ' '; |
|
| 257 | 257 | } |
| 258 | 258 | $ret .= TokensList::build($component->unknown); |
| 259 | 259 | |
@@ -146,7 +146,7 @@ |
||
| 146 | 146 | { |
| 147 | 147 | return trim( |
| 148 | 148 | $component->table |
| 149 | - .' ('.implode(', ', Context::escape($component->columns)).') ' |
|
| 149 | + .' (' . implode(', ', Context::escape($component->columns)) . ') ' |
|
| 150 | 150 | .$component->options |
| 151 | 151 | ); |
| 152 | 152 | } |
@@ -158,9 +158,9 @@ |
||
| 158 | 158 | |
| 159 | 159 | $parameters = ''; |
| 160 | 160 | if (!empty($component->parameters)) { |
| 161 | - $parameters = '('.implode(',', $component->parameters).')'; |
|
| 161 | + $parameters = '(' . implode(',', $component->parameters) . ')'; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - return trim($name.$parameters.' '.$component->options); |
|
| 164 | + return trim($name . $parameters . ' ' . $component->options); |
|
| 165 | 165 | } |
| 166 | 166 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $tmp = array(); |
| 30 | 30 | foreach ($component as $component) { |
| 31 | - $tmp[] = $component[0].' '.$component[1]; |
|
| 31 | + $tmp[] = $component[0] . ' ' . $component[1]; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | return implode(' ', $tmp); |
@@ -134,7 +134,7 @@ |
||
| 134 | 134 | if (is_array($component)) { |
| 135 | 135 | return implode(', ', $component); |
| 136 | 136 | } else { |
| 137 | - return $component->expr.' '.$component->type; |
|
| 137 | + return $component->expr . ' ' . $component->type; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ':=' => 8, |
| 114 | 114 | |
| 115 | 115 | // @see Token::FLAG_OPERATOR_SQL |
| 116 | - '(' => 16, ')' => 16, '.' => 16, ',' => 16, ';' => 16, |
|
| 116 | + '(' => 16, ')' => 16, '.' => 16, ',' => 16, ';' => 16, |
|
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -441,11 +441,11 @@ discard block |
||
| 441 | 441 | } |
| 442 | 442 | if ($context[0] !== '\\') { |
| 443 | 443 | // Short context name (must be formatted into class name). |
| 444 | - $context = self::$contextPrefix.$context; |
|
| 444 | + $context = self::$contextPrefix . $context; |
|
| 445 | 445 | } |
| 446 | 446 | if (!class_exists($context)) { |
| 447 | 447 | throw new \Exception( |
| 448 | - 'Specified context ("'.$context.'") does not exist.' |
|
| 448 | + 'Specified context ("' . $context . '") does not exist.' |
|
| 449 | 449 | ); |
| 450 | 450 | } |
| 451 | 451 | self::$loadedContext = $context; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | } |
| 515 | 515 | $mode = explode(',', $mode); |
| 516 | 516 | foreach ($mode as $m) { |
| 517 | - static::$MODE |= constant('static::'.$m); |
|
| 517 | + static::$MODE |= constant('static::' . $m); |
|
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $quote = '"'; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - return $quote.str_replace($quote, $quote.$quote, $str).$quote; |
|
| 549 | + return $quote . str_replace($quote, $quote . $quote, $str) . $quote; |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
@@ -50,46 +50,46 @@ discard block |
||
| 50 | 50 | * @var string |
| 51 | 51 | */ |
| 52 | 52 | const TEMPLATE = |
| 53 | - '<?php'."\n". |
|
| 54 | - ''."\n". |
|
| 55 | - '/**'."\n". |
|
| 56 | - ' * Context for %1$s.'."\n". |
|
| 57 | - ' *'."\n". |
|
| 58 | - ' * This file was auto-generated.'."\n". |
|
| 59 | - ' *'."\n". |
|
| 60 | - ' * @package SqlParser'."\n". |
|
| 61 | - ' * @subpackage Contexts'."\n". |
|
| 62 | - ' * @link %3$s'."\n". |
|
| 63 | - ' */'."\n". |
|
| 64 | - 'namespace SqlParser\\Contexts;'."\n". |
|
| 65 | - ''."\n". |
|
| 66 | - 'use SqlParser\\Context;'."\n". |
|
| 67 | - ''."\n". |
|
| 68 | - '/**'."\n". |
|
| 69 | - ' * Context for %1$s.'."\n". |
|
| 70 | - ' *'."\n". |
|
| 71 | - ' * @category Contexts'."\n". |
|
| 72 | - ' * @package SqlParser'."\n". |
|
| 73 | - ' * @subpackage Contexts'."\n". |
|
| 74 | - ' * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+'."\n". |
|
| 75 | - ' */'."\n". |
|
| 76 | - 'class %2$s extends Context'."\n". |
|
| 77 | - '{'."\n". |
|
| 78 | - ''."\n". |
|
| 79 | - ' /**'."\n". |
|
| 80 | - ' * List of keywords.'."\n". |
|
| 81 | - ' *'."\n". |
|
| 82 | - ' * The value associated to each keyword represents its flags.'."\n". |
|
| 83 | - ' *'."\n". |
|
| 84 | - ' * @see Token::FLAG_KEYWORD_*'."\n". |
|
| 85 | - ' *'."\n". |
|
| 86 | - ' * @var array'."\n". |
|
| 87 | - ' */'."\n". |
|
| 88 | - ' public static $KEYWORDS = array('."\n". |
|
| 89 | - ''."\n". |
|
| 90 | - '%4$s'. |
|
| 91 | - ' );'."\n". |
|
| 92 | - '}'."\n"; |
|
| 53 | + '<?php' . "\n" . |
|
| 54 | + '' . "\n" . |
|
| 55 | + '/**' . "\n" . |
|
| 56 | + ' * Context for %1$s.' . "\n" . |
|
| 57 | + ' *' . "\n" . |
|
| 58 | + ' * This file was auto-generated.' . "\n" . |
|
| 59 | + ' *' . "\n" . |
|
| 60 | + ' * @package SqlParser' . "\n" . |
|
| 61 | + ' * @subpackage Contexts' . "\n" . |
|
| 62 | + ' * @link %3$s' . "\n" . |
|
| 63 | + ' */' . "\n" . |
|
| 64 | + 'namespace SqlParser\\Contexts;' . "\n" . |
|
| 65 | + '' . "\n" . |
|
| 66 | + 'use SqlParser\\Context;' . "\n" . |
|
| 67 | + '' . "\n" . |
|
| 68 | + '/**' . "\n" . |
|
| 69 | + ' * Context for %1$s.' . "\n" . |
|
| 70 | + ' *' . "\n" . |
|
| 71 | + ' * @category Contexts' . "\n" . |
|
| 72 | + ' * @package SqlParser' . "\n" . |
|
| 73 | + ' * @subpackage Contexts' . "\n" . |
|
| 74 | + ' * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+' . "\n" . |
|
| 75 | + ' */' . "\n" . |
|
| 76 | + 'class %2$s extends Context' . "\n" . |
|
| 77 | + '{' . "\n" . |
|
| 78 | + '' . "\n" . |
|
| 79 | + ' /**' . "\n" . |
|
| 80 | + ' * List of keywords.' . "\n" . |
|
| 81 | + ' *' . "\n" . |
|
| 82 | + ' * The value associated to each keyword represents its flags.' . "\n" . |
|
| 83 | + ' *' . "\n" . |
|
| 84 | + ' * @see Token::FLAG_KEYWORD_*' . "\n" . |
|
| 85 | + ' *' . "\n" . |
|
| 86 | + ' * @var array' . "\n" . |
|
| 87 | + ' */' . "\n" . |
|
| 88 | + ' public static $KEYWORDS = array(' . "\n" . |
|
| 89 | + '' . "\n" . |
|
| 90 | + '%4$s' . |
|
| 91 | + ' );' . "\n" . |
|
| 92 | + '}' . "\n"; |
|
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * Sorts an array of words. |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | if ($i == 0) { |
| 196 | 196 | $ret .= str_repeat(' ', $spaces); |
| 197 | 197 | } |
| 198 | - $ret .= "'".$word."' => ".$type.', '; |
|
| 198 | + $ret .= "'" . $word . "' => " . $type . ', '; |
|
| 199 | 199 | if (++$i == $count) { |
| 200 | 200 | $ret .= "\n"; |
| 201 | 201 | $i = 0; |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @var string |
| 255 | 255 | */ |
| 256 | - $directory = dirname($input).'/'; |
|
| 256 | + $directory = dirname($input) . '/'; |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * The name of the file that contains the context. |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @var string |
| 276 | 276 | */ |
| 277 | - $class = 'Context'.$name; |
|
| 277 | + $class = 'Context' . $name; |
|
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | 280 | * The formatted name of this context. |
@@ -282,13 +282,13 @@ discard block |
||
| 282 | 282 | * @var string |
| 283 | 283 | */ |
| 284 | 284 | $formattedName = str_replace( |
| 285 | - array('Context', 'MySql', '00', '0'), |
|
| 286 | - array('', 'MySQL ', '', '.'), |
|
| 285 | + array('Context', 'MySql', '00', '0'), |
|
| 286 | + array('', 'MySQL ', '', '.'), |
|
| 287 | 287 | $class |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | 290 | file_put_contents( |
| 291 | - $output.'/'.$class.'.php', |
|
| 291 | + $output . '/' . $class . '.php', |
|
| 292 | 292 | static::generate( |
| 293 | 293 | array( |
| 294 | 294 | 'name' => $formattedName, |
@@ -296,9 +296,9 @@ discard block |
||
| 296 | 296 | 'link' => static::$LINKS[$name], |
| 297 | 297 | 'keywords' => static::readWords( |
| 298 | 298 | array( |
| 299 | - $directory.'_common.txt', |
|
| 300 | - $directory.'_functions'.$file, |
|
| 301 | - $directory.$file, |
|
| 299 | + $directory . '_common.txt', |
|
| 300 | + $directory . '_functions' . $file, |
|
| 301 | + $directory . $file, |
|
| 302 | 302 | ) |
| 303 | 303 | ), |
| 304 | 304 | ) |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | // Building the context. |
| 326 | 326 | sprintf("Building context for %s...\n", $file); |
| 327 | - static::build($input.'/'.$file, $output); |
|
| 327 | + static::build($input . '/' . $file, $output); |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | } |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // Appending the filename to directories. |
| 147 | - $inputFile = $input.'/'.$file; |
|
| 148 | - $outputFile = $output.'/'.$file; |
|
| 149 | - $debugFile = ($debug !== null) ? $debug.'/'.$file : null; |
|
| 147 | + $inputFile = $input . '/' . $file; |
|
| 148 | + $outputFile = $output . '/' . $file; |
|
| 149 | + $debugFile = ($debug !== null) ? $debug . '/' . $file : null; |
|
| 150 | 150 | |
| 151 | 151 | if (is_dir($inputFile)) { |
| 152 | 152 | // Creating required directories to maintain the structure. |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | } elseif (substr($inputFile, -3) === '.in') { |
| 164 | 164 | // Generating file names by replacing `.in` with `.out` and |
| 165 | 165 | // `.debug`. |
| 166 | - $outputFile = substr($outputFile, 0, -3).'.out'; |
|
| 166 | + $outputFile = substr($outputFile, 0, -3) . '.out'; |
|
| 167 | 167 | if ($debug !== null) { |
| 168 | - $debugFile = substr($debugFile, 0, -3).'.debug'; |
|
| 168 | + $debugFile = substr($debugFile, 0, -3) . '.debug'; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // Building the test. |