@@ -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 | } |
@@ -127,6 +127,6 @@ |
||
| 127 | 127 | */ |
| 128 | 128 | public static function build($component, array $options = array()) |
| 129 | 129 | { |
| 130 | - return $component->offset . ', ' . $component->rowCount; |
|
| 130 | + return $component->offset.', '.$component->rowCount; |
|
| 131 | 131 | } |
| 132 | 132 | } |
@@ -254,14 +254,14 @@ discard block |
||
| 254 | 254 | $ret = 'CASE '; |
| 255 | 255 | if (isset($component->value)) { |
| 256 | 256 | // Syntax type 0 |
| 257 | - $ret .= $component->value . ' '; |
|
| 257 | + $ret .= $component->value.' '; |
|
| 258 | 258 | for ( |
| 259 | 259 | $i = 0; |
| 260 | 260 | $i < count($component->compare_values) && $i < count($component->results); |
| 261 | 261 | $i++ |
| 262 | 262 | ) { |
| 263 | - $ret .= 'WHEN ' . $component->compare_values[$i] . ' '; |
|
| 264 | - $ret .= 'THEN ' . $component->results[$i] . ' '; |
|
| 263 | + $ret .= 'WHEN '.$component->compare_values[$i].' '; |
|
| 264 | + $ret .= 'THEN '.$component->results[$i].' '; |
|
| 265 | 265 | } |
| 266 | 266 | } else { |
| 267 | 267 | // Syntax type 1 |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | $i < count($component->conditions) && $i < count($component->results); |
| 271 | 271 | $i++ |
| 272 | 272 | ) { |
| 273 | - $ret .= 'WHEN ' . Condition::build($component->conditions[$i]) . ' '; |
|
| 274 | - $ret .= 'THEN ' . $component->results[$i] . ' '; |
|
| 273 | + $ret .= 'WHEN '.Condition::build($component->conditions[$i]).' '; |
|
| 274 | + $ret .= 'THEN '.$component->results[$i].' '; |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | if (isset($component->else_result)) { |
| 278 | - $ret .= 'ELSE ' . $component->else_result . ' '; |
|
| 278 | + $ret .= 'ELSE '.$component->else_result.' '; |
|
| 279 | 279 | } |
| 280 | 280 | $ret .= 'END'; |
| 281 | 281 | |
@@ -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 | } |
@@ -183,11 +183,11 @@ |
||
| 183 | 183 | { |
| 184 | 184 | $ret = array(); |
| 185 | 185 | foreach ($component as $c) { |
| 186 | - $ret[] = array_search($c->type, static::$JOINS) . ' ' . $c->expr |
|
| 186 | + $ret[] = array_search($c->type, static::$JOINS).' '.$c->expr |
|
| 187 | 187 | . (!empty($c->on) |
| 188 | - ? ' ON ' . Condition::build($c->on) : '') |
|
| 188 | + ? ' ON '.Condition::build($c->on) : '') |
|
| 189 | 189 | . (!empty($c->using) |
| 190 | - ? ' USING ' . ArrayObj::build($c->using) : ''); |
|
| 190 | + ? ' USING '.ArrayObj::build($c->using) : ''); |
|
| 191 | 191 | } |
| 192 | 192 | return implode(' ', $ret); |
| 193 | 193 | } |
@@ -138,10 +138,10 @@ |
||
| 138 | 138 | { |
| 139 | 139 | if ($component->dest instanceof Expression) { |
| 140 | 140 | $columns = !empty($component->columns) ? |
| 141 | - '(`' . implode('`, `', $component->columns) . '`)' : ''; |
|
| 142 | - return $component->dest . $columns; |
|
| 141 | + '(`'.implode('`, `', $component->columns).'`)' : ''; |
|
| 142 | + return $component->dest.$columns; |
|
| 143 | 143 | } else { |
| 144 | - return 'OUTFILE "' . $component->dest . '"'; |
|
| 144 | + return 'OUTFILE "'.$component->dest.'"'; |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | \ No newline at end of file |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | * @var array |
| 72 | 72 | */ |
| 73 | 73 | public static $CLAUSES = array( |
| 74 | - 'DELETE' => array('DELETE', 2), |
|
| 74 | + 'DELETE' => array('DELETE', 2), |
|
| 75 | 75 | // Used for options. |
| 76 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
| 77 | - 'FROM' => array('FROM', 3), |
|
| 78 | - 'PARTITION' => array('PARTITION', 3), |
|
| 79 | - 'USING' => array('USING', 3), |
|
| 80 | - 'WHERE' => array('WHERE', 3), |
|
| 81 | - 'ORDER BY' => array('ORDER BY', 3), |
|
| 82 | - 'LIMIT' => array('LIMIT', 3), |
|
| 76 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
| 77 | + 'FROM' => array('FROM', 3), |
|
| 78 | + 'PARTITION' => array('PARTITION', 3), |
|
| 79 | + 'USING' => array('USING', 3), |
|
| 80 | + 'WHERE' => array('WHERE', 3), |
|
| 81 | + 'ORDER BY' => array('ORDER BY', 3), |
|
| 82 | + 'LIMIT' => array('LIMIT', 3), |
|
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -137,25 +137,25 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function build() |
| 139 | 139 | { |
| 140 | - $ret = 'DELETE ' . OptionsArray::build($this->options); |
|
| 140 | + $ret = 'DELETE '.OptionsArray::build($this->options); |
|
| 141 | 141 | |
| 142 | 142 | if ($this->columns != NULL && count($this->columns) > 0) { |
| 143 | - $ret .= ' ' . ExpressionArray::build($this->columns); |
|
| 143 | + $ret .= ' '.ExpressionArray::build($this->columns); |
|
| 144 | 144 | } |
| 145 | 145 | if ($this->from != NULL && count($this->from) > 0) { |
| 146 | - $ret .= ' FROM ' . ExpressionArray::build($this->from); |
|
| 146 | + $ret .= ' FROM '.ExpressionArray::build($this->from); |
|
| 147 | 147 | } |
| 148 | 148 | if ($this->using != NULL && count($this->using) > 0) { |
| 149 | - $ret .= ' USING ' . ExpressionArray::build($this->using); |
|
| 149 | + $ret .= ' USING '.ExpressionArray::build($this->using); |
|
| 150 | 150 | } |
| 151 | 151 | if ($this->where != NULL && count($this->where) > 0) { |
| 152 | - $ret .= ' WHERE ' . Condition::build($this->where); |
|
| 152 | + $ret .= ' WHERE '.Condition::build($this->where); |
|
| 153 | 153 | } |
| 154 | 154 | if ($this->order != NULL && count($this->order) > 0) { |
| 155 | - $ret .= ' ORDER BY ' . ExpressionArray::build($this->order); |
|
| 155 | + $ret .= ' ORDER BY '.ExpressionArray::build($this->order); |
|
| 156 | 156 | } |
| 157 | 157 | if ($this->limit != NULL && count($this->limit) > 0) { |
| 158 | - $ret .= ' LIMIT ' . Limit::build($this->limit); |
|
| 158 | + $ret .= ' LIMIT '.Limit::build($this->limit); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | return $ret; |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @var int |
| 31 | 31 | */ |
| 32 | - const TYPE_NONE = 0; |
|
| 32 | + const TYPE_NONE = 0; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * SQL specific keywords: SELECT, UPDATE, INSERT, etc. |
| 36 | 36 | * |
| 37 | 37 | * @var int |
| 38 | 38 | */ |
| 39 | - const TYPE_KEYWORD = 1; |
|
| 39 | + const TYPE_KEYWORD = 1; |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Any type of legal operator. |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @var int |
| 52 | 52 | */ |
| 53 | - const TYPE_OPERATOR = 2; |
|
| 53 | + const TYPE_OPERATOR = 2; |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Spaces, tabs, new lines, etc. |
| 57 | 57 | * |
| 58 | 58 | * @var int |
| 59 | 59 | */ |
| 60 | - const TYPE_WHITESPACE = 3; |
|
| 60 | + const TYPE_WHITESPACE = 3; |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Any type of legal comment. |
@@ -79,21 +79,21 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @var int |
| 81 | 81 | */ |
| 82 | - const TYPE_COMMENT = 4; |
|
| 82 | + const TYPE_COMMENT = 4; |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Boolean values: true or false. |
| 86 | 86 | * |
| 87 | 87 | * @var int |
| 88 | 88 | */ |
| 89 | - const TYPE_BOOL = 5; |
|
| 89 | + const TYPE_BOOL = 5; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Numbers: 4, 0x8, 15.16, 23e42, etc. |
| 93 | 93 | * |
| 94 | 94 | * @var int |
| 95 | 95 | */ |
| 96 | - const TYPE_NUMBER = 6; |
|
| 96 | + const TYPE_NUMBER = 6; |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Literal strings: 'string', "test". |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @var int |
| 103 | 103 | */ |
| 104 | - const TYPE_STRING = 7; |
|
| 104 | + const TYPE_STRING = 7; |
|
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Database, table names, variables, etc. |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @var int |
| 111 | 111 | */ |
| 112 | - const TYPE_SYMBOL = 8; |
|
| 112 | + const TYPE_SYMBOL = 8; |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * Delimits an unknown string. |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @var int |
| 119 | 119 | */ |
| 120 | - const TYPE_DELIMITER = 9; |
|
| 120 | + const TYPE_DELIMITER = 9; |
|
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * Labels in LOOP statement, ITERATE statement etc. |
@@ -129,46 +129,46 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @var int |
| 131 | 131 | */ |
| 132 | - const TYPE_LABEL = 10; |
|
| 132 | + const TYPE_LABEL = 10; |
|
| 133 | 133 | |
| 134 | 134 | // Flags that describe the tokens in more detail. |
| 135 | 135 | // All keywords must have flag 1 so `Context::isKeyword` method doesn't |
| 136 | 136 | // require strict comparison. |
| 137 | - const FLAG_KEYWORD_RESERVED = 2; |
|
| 138 | - const FLAG_KEYWORD_COMPOSED = 4; |
|
| 139 | - const FLAG_KEYWORD_DATA_TYPE = 8; |
|
| 137 | + const FLAG_KEYWORD_RESERVED = 2; |
|
| 138 | + const FLAG_KEYWORD_COMPOSED = 4; |
|
| 139 | + const FLAG_KEYWORD_DATA_TYPE = 8; |
|
| 140 | 140 | const FLAG_KEYWORD_KEY = 16; |
| 141 | 141 | const FLAG_KEYWORD_FUNCTION = 32; |
| 142 | 142 | |
| 143 | 143 | // Numbers related flags. |
| 144 | - const FLAG_NUMBER_HEX = 1; |
|
| 145 | - const FLAG_NUMBER_FLOAT = 2; |
|
| 146 | - const FLAG_NUMBER_APPROXIMATE = 4; |
|
| 147 | - const FLAG_NUMBER_NEGATIVE = 8; |
|
| 144 | + const FLAG_NUMBER_HEX = 1; |
|
| 145 | + const FLAG_NUMBER_FLOAT = 2; |
|
| 146 | + const FLAG_NUMBER_APPROXIMATE = 4; |
|
| 147 | + const FLAG_NUMBER_NEGATIVE = 8; |
|
| 148 | 148 | const FLAG_NUMBER_BINARY = 16; |
| 149 | 149 | |
| 150 | 150 | // Strings related flags. |
| 151 | - const FLAG_STRING_SINGLE_QUOTES = 1; |
|
| 152 | - const FLAG_STRING_DOUBLE_QUOTES = 2; |
|
| 151 | + const FLAG_STRING_SINGLE_QUOTES = 1; |
|
| 152 | + const FLAG_STRING_DOUBLE_QUOTES = 2; |
|
| 153 | 153 | |
| 154 | 154 | // Comments related flags. |
| 155 | - const FLAG_COMMENT_BASH = 1; |
|
| 156 | - const FLAG_COMMENT_C = 2; |
|
| 157 | - const FLAG_COMMENT_SQL = 4; |
|
| 158 | - const FLAG_COMMENT_MYSQL_CMD = 8; |
|
| 155 | + const FLAG_COMMENT_BASH = 1; |
|
| 156 | + const FLAG_COMMENT_C = 2; |
|
| 157 | + const FLAG_COMMENT_SQL = 4; |
|
| 158 | + const FLAG_COMMENT_MYSQL_CMD = 8; |
|
| 159 | 159 | |
| 160 | 160 | // Operators related flags. |
| 161 | - const FLAG_OPERATOR_ARITHMETIC = 1; |
|
| 162 | - const FLAG_OPERATOR_LOGICAL = 2; |
|
| 163 | - const FLAG_OPERATOR_BITWISE = 4; |
|
| 164 | - const FLAG_OPERATOR_ASSIGNMENT = 8; |
|
| 161 | + const FLAG_OPERATOR_ARITHMETIC = 1; |
|
| 162 | + const FLAG_OPERATOR_LOGICAL = 2; |
|
| 163 | + const FLAG_OPERATOR_BITWISE = 4; |
|
| 164 | + const FLAG_OPERATOR_ASSIGNMENT = 8; |
|
| 165 | 165 | const FLAG_OPERATOR_SQL = 16; |
| 166 | 166 | |
| 167 | 167 | // Symbols related flags. |
| 168 | - const FLAG_SYMBOL_VARIABLE = 1; |
|
| 169 | - const FLAG_SYMBOL_BACKTICK = 2; |
|
| 170 | - const FLAG_SYMBOL_USER = 4; |
|
| 171 | - const FLAG_SYMBOL_SYSTEM = 8; |
|
| 168 | + const FLAG_SYMBOL_VARIABLE = 1; |
|
| 169 | + const FLAG_SYMBOL_BACKTICK = 2; |
|
| 170 | + const FLAG_SYMBOL_USER = 4; |
|
| 171 | + const FLAG_SYMBOL_SYSTEM = 8; |
|
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | 174 | * The token it its raw string representation. |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | return $ret; |
| 262 | 262 | case Token::TYPE_STRING: |
| 263 | 263 | $quote = $this->token[0]; |
| 264 | - $str = str_replace($quote . $quote, $quote, $this->token); |
|
| 264 | + $str = str_replace($quote.$quote, $quote, $this->token); |
|
| 265 | 265 | return mb_substr($str, 1, -1, 'UTF-8'); // trims quotes |
| 266 | 266 | case Token::TYPE_SYMBOL: |
| 267 | 267 | $str = $this->token; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | || ($str[0] === '"') || ($str[0] === '\'')) |
| 280 | 280 | ) { |
| 281 | 281 | $quote = $str[0]; |
| 282 | - $str = str_replace($quote . $quote, $quote, $str); |
|
| 282 | + $str = str_replace($quote.$quote, $quote, $str); |
|
| 283 | 283 | $str = mb_substr($str, 1, -1, 'UTF-8'); |
| 284 | 284 | } |
| 285 | 285 | return $str; |