@@ -27,11 +27,11 @@ |
||
| 27 | 27 | $debug = empty($argv[3]) ? null : rtrim($argv[3], '/'); |
| 28 | 28 | |
| 29 | 29 | // Checking if all directories are valid. |
| 30 | -if (! is_dir($input)) { |
|
| 30 | +if (!is_dir($input)) { |
|
| 31 | 31 | throw new Exception('The input directory does not exist.'); |
| 32 | -} elseif (! is_dir($output)) { |
|
| 32 | +} elseif (!is_dir($output)) { |
|
| 33 | 33 | throw new Exception('The output directory does not exist.'); |
| 34 | -} elseif (($debug !== null) && (! is_dir($debug))) { |
|
| 34 | +} elseif (($debug !== null) && (!is_dir($debug))) { |
|
| 35 | 35 | throw new Exception('The debug directory does not exist.'); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | $output = rtrim($argv[2], '/'); |
| 27 | 27 | |
| 28 | 28 | // Checking if all directories are valid. |
| 29 | -if (! is_dir($input)) { |
|
| 29 | +if (!is_dir($input)) { |
|
| 30 | 30 | throw new Exception('The input directory does not exist.'); |
| 31 | -} elseif (! is_dir($output)) { |
|
| 31 | +} elseif (!is_dir($output)) { |
|
| 32 | 32 | throw new Exception('The output directory does not exist.'); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | public static function getForeignKeys($statement) |
| 27 | 27 | { |
| 28 | 28 | if (empty($statement->fields) |
| 29 | - || (! is_array($statement->fields)) |
|
| 30 | - || (! $statement->options->has('TABLE')) |
|
| 29 | + || (!is_array($statement->fields)) |
|
| 30 | + || (!$statement->options->has('TABLE')) |
|
| 31 | 31 | ) { |
| 32 | 32 | return []; |
| 33 | 33 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'index_list' => $columns, |
| 50 | 50 | ]; |
| 51 | 51 | |
| 52 | - if (! empty($field->references)) { |
|
| 52 | + if (!empty($field->references)) { |
|
| 53 | 53 | $tmp['ref_db_name'] = $field->references->table->database; |
| 54 | 54 | $tmp['ref_table_name'] = $field->references->table->table; |
| 55 | 55 | $tmp['ref_index_list'] = $field->references->columns; |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | public static function getFields($statement) |
| 84 | 84 | { |
| 85 | 85 | if (empty($statement->fields) |
| 86 | - || (! is_array($statement->fields)) |
|
| 87 | - || (! $statement->options->has('TABLE')) |
|
| 86 | + || (!is_array($statement->fields)) |
|
| 87 | + || (!$statement->options->has('TABLE')) |
|
| 88 | 88 | ) { |
| 89 | 89 | return []; |
| 90 | 90 | } |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | 'opts' => [], |
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | - if (! empty($statement->parameters)) { |
|
| 120 | + if (!empty($statement->parameters)) { |
|
| 121 | 121 | $idx = 0; |
| 122 | 122 | foreach ($statement->parameters as $param) { |
| 123 | 123 | $retval['dir'][$idx] = $param->inOut; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function getAliases($statement, $database) |
| 27 | 27 | { |
| 28 | - if (! ($statement instanceof SelectStatement) |
|
| 28 | + if (!($statement instanceof SelectStatement) |
|
| 29 | 29 | || empty($statement->expr) |
| 30 | 30 | || empty($statement->from) |
| 31 | 31 | ) { |
@@ -45,28 +45,28 @@ discard block |
||
| 45 | 45 | $expressions = $statement->from; |
| 46 | 46 | |
| 47 | 47 | // Adding expressions from JOIN. |
| 48 | - if (! empty($statement->join)) { |
|
| 48 | + if (!empty($statement->join)) { |
|
| 49 | 49 | foreach ($statement->join as $join) { |
| 50 | 50 | $expressions[] = $join->expr; |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | foreach ($expressions as $expr) { |
| 55 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
| 55 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
| 56 | 56 | continue; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $thisDb = isset($expr->database) && ($expr->database !== '') ? |
| 60 | 60 | $expr->database : $database; |
| 61 | 61 | |
| 62 | - if (! isset($retval[$thisDb])) { |
|
| 62 | + if (!isset($retval[$thisDb])) { |
|
| 63 | 63 | $retval[$thisDb] = [ |
| 64 | 64 | 'alias' => null, |
| 65 | 65 | 'tables' => [], |
| 66 | 66 | ]; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (! isset($retval[$thisDb]['tables'][$expr->table])) { |
|
| 69 | + if (!isset($retval[$thisDb]['tables'][$expr->table])) { |
|
| 70 | 70 | $retval[$thisDb]['tables'][$expr->table] = [ |
| 71 | 71 | 'alias' => isset($expr->alias) && ($expr->alias !== '') ? |
| 72 | 72 | $expr->alias : null, |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ]; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (! isset($tables[$thisDb])) { |
|
| 77 | + if (!isset($tables[$thisDb])) { |
|
| 78 | 78 | $tables[$thisDb] = []; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | foreach ($statement->expr as $expr) { |
| 85 | - if (! isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '') |
|
| 85 | + if (!isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '') |
|
| 86 | 86 | ) { |
| 87 | 87 | continue; |
| 88 | 88 | } |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | /* Sanitize the array so that we do not have to care later */ |
| 266 | 266 | foreach ($newFormats as $j => $new) { |
| 267 | 267 | foreach ($integers as $name) { |
| 268 | - if (! isset($new[$name])) { |
|
| 268 | + if (!isset($new[$name])) { |
|
| 269 | 269 | $newFormats[$j][$name] = 0; |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | foreach ($strings as $name) { |
| 274 | - if (! isset($new[$name])) { |
|
| 274 | + if (!isset($new[$name])) { |
|
| 275 | 275 | $newFormats[$j][$name] = ''; |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | /* Add not already handled formats */ |
| 293 | 293 | foreach ($newFormats as $j => $new) { |
| 294 | - if (! in_array($j, $added)) { |
|
| 294 | + if (!in_array($j, $added)) { |
|
| 295 | 295 | $formats[] = $new; |
| 296 | 296 | } |
| 297 | 297 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | // The options of a clause should stay on the same line and everything that follows. |
| 421 | 421 | if ($this->options['parts_newline'] |
| 422 | - && ! $formattedOptions |
|
| 422 | + && !$formattedOptions |
|
| 423 | 423 | && empty(self::$INLINE_CLAUSES[$lastClause]) |
| 424 | 424 | && ( |
| 425 | 425 | $curr->type !== Token::TYPE_KEYWORD |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | if (end($blocksLineEndings) === true |
| 477 | 477 | || ( |
| 478 | 478 | empty(self::$INLINE_CLAUSES[$lastClause]) |
| 479 | - && ! $shortGroup |
|
| 479 | + && !$shortGroup |
|
| 480 | 480 | && $this->options['parts_newline'] |
| 481 | 481 | ) |
| 482 | 482 | ) { |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | // Also, some tokens do not have spaces before or after them. |
| 518 | 518 | if (// A space after delimiters that are longer than 2 characters. |
| 519 | 519 | $prev->keyword === 'DELIMITER' |
| 520 | - || ! ( |
|
| 520 | + || !( |
|
| 521 | 521 | ($prev->type === Token::TYPE_OPERATOR && ($prev->value === '.' || $prev->value === '(')) |
| 522 | 522 | // No space after . ( |
| 523 | 523 | || ($curr->type === Token::TYPE_OPERATOR |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | && ($token->flags & $format['flags']) === $format['flags'] |
| 636 | 636 | ) { |
| 637 | 637 | // Running transformation function. |
| 638 | - if (! empty($format['function'])) { |
|
| 638 | + if (!empty($format['function'])) { |
|
| 639 | 639 | $func = $format['function']; |
| 640 | 640 | $text = $func($text); |
| 641 | 641 | } |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $this->mergeLongOpts($params, $longopts); |
| 66 | - if (! isset($params['f'])) { |
|
| 66 | + if (!isset($params['f'])) { |
|
| 67 | 67 | $params['f'] = 'cli'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (! in_array($params['f'], ['html', 'cli', 'text'])) { |
|
| 70 | + if (!in_array($params['f'], ['html', 'cli', 'text'])) { |
|
| 71 | 71 | echo "ERROR: Invalid value for format!\n"; |
| 72 | 72 | |
| 73 | 73 | return false; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return 0; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if (! isset($params['q'])) { |
|
| 92 | + if (!isset($params['q'])) { |
|
| 93 | 93 | $stdIn = $this->readStdin(); |
| 94 | 94 | |
| 95 | 95 | if ($stdIn) { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | Context::load($params['c']); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (! isset($params['q'])) { |
|
| 159 | + if (!isset($params['q'])) { |
|
| 160 | 160 | $stdIn = $this->readStdin(); |
| 161 | 161 | |
| 162 | 162 | if ($stdIn) { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | return 0; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if (! isset($params['q'])) { |
|
| 226 | + if (!isset($params['q'])) { |
|
| 227 | 227 | $stdIn = $this->readStdin(); |
| 228 | 228 | |
| 229 | 229 | if ($stdIn) { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $flags['querytype'] = 'SELECT'; |
| 231 | 231 | $flags['is_select'] = true; |
| 232 | 232 | |
| 233 | - if (! empty($statement->from)) { |
|
| 233 | + if (!empty($statement->from)) { |
|
| 234 | 234 | $flags['select_from'] = true; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -238,25 +238,25 @@ discard block |
||
| 238 | 238 | $flags['distinct'] = true; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if (! empty($statement->group) || ! empty($statement->having)) { |
|
| 241 | + if (!empty($statement->group) || !empty($statement->having)) { |
|
| 242 | 242 | $flags['is_group'] = true; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if (! empty($statement->into) |
|
| 245 | + if (!empty($statement->into) |
|
| 246 | 246 | && ($statement->into->type === 'OUTFILE') |
| 247 | 247 | ) { |
| 248 | 248 | $flags['is_export'] = true; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $expressions = $statement->expr; |
| 252 | - if (! empty($statement->join)) { |
|
| 252 | + if (!empty($statement->join)) { |
|
| 253 | 253 | foreach ($statement->join as $join) { |
| 254 | 254 | $expressions[] = $join->expr; |
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | foreach ($expressions as $expr) { |
| 259 | - if (! empty($expr->function)) { |
|
| 259 | + if (!empty($expr->function)) { |
|
| 260 | 260 | if ($expr->function === 'COUNT') { |
| 261 | 261 | $flags['is_count'] = true; |
| 262 | 262 | } elseif (in_array($expr->function, static::$FUNCTIONS)) { |
@@ -264,30 +264,30 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - if (! empty($expr->subquery)) { |
|
| 267 | + if (!empty($expr->subquery)) { |
|
| 268 | 268 | $flags['is_subquery'] = true; |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if (! empty($statement->procedure) |
|
| 272 | + if (!empty($statement->procedure) |
|
| 273 | 273 | && ($statement->procedure->name === 'ANALYSE') |
| 274 | 274 | ) { |
| 275 | 275 | $flags['is_analyse'] = true; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if (! empty($statement->group)) { |
|
| 278 | + if (!empty($statement->group)) { |
|
| 279 | 279 | $flags['group'] = true; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if (! empty($statement->having)) { |
|
| 282 | + if (!empty($statement->having)) { |
|
| 283 | 283 | $flags['having'] = true; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - if (! empty($statement->union)) { |
|
| 286 | + if (!empty($statement->union)) { |
|
| 287 | 287 | $flags['union'] = true; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if (! empty($statement->join)) { |
|
| 290 | + if (!empty($statement->join)) { |
|
| 291 | 291 | $flags['join'] = true; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -378,11 +378,11 @@ discard block |
||
| 378 | 378 | || ($statement instanceof UpdateStatement) |
| 379 | 379 | || ($statement instanceof DeleteStatement) |
| 380 | 380 | ) { |
| 381 | - if (! empty($statement->limit)) { |
|
| 381 | + if (!empty($statement->limit)) { |
|
| 382 | 382 | $flags['limit'] = true; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - if (! empty($statement->order)) { |
|
| 385 | + if (!empty($statement->order)) { |
|
| 386 | 386 | $flags['order'] = true; |
| 387 | 387 | } |
| 388 | 388 | } |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | ]; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if (! in_array($arr, $ret['select_tables'])) { |
|
| 454 | + if (!in_array($arr, $ret['select_tables'])) { |
|
| 455 | 455 | $ret['select_tables'][] = $arr; |
| 456 | 456 | } |
| 457 | 457 | } else { |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | isset($expr->database) && ($expr->database !== '') ? |
| 471 | 471 | $expr->database : null, |
| 472 | 472 | ]; |
| 473 | - if (! in_array($arr, $ret['select_tables'])) { |
|
| 473 | + if (!in_array($arr, $ret['select_tables'])) { |
|
| 474 | 474 | $ret['select_tables'][] = $arr; |
| 475 | 475 | } |
| 476 | 476 | } |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | ) { |
| 508 | 508 | $expressions = [$statement->table]; |
| 509 | 509 | } elseif ($statement instanceof DropStatement) { |
| 510 | - if (! $statement->options->has('TABLE')) { |
|
| 510 | + if (!$statement->options->has('TABLE')) { |
|
| 511 | 511 | // No tables are dropped. |
| 512 | 512 | return []; |
| 513 | 513 | } |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | $ret = []; |
| 523 | 523 | foreach ($expressions as $expr) { |
| 524 | - if (! empty($expr->table)) { |
|
| 524 | + if (!empty($expr->table)) { |
|
| 525 | 525 | $expr->expr = null; // Force rebuild. |
| 526 | 526 | $expr->alias = null; // Aliases are not required. |
| 527 | 527 | $ret[] = Expression::build($expr); |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | $statement .= $token->token; |
| 793 | 793 | |
| 794 | - if (($token->type === Token::TYPE_DELIMITER) && ! empty($token->token)) { |
|
| 794 | + if (($token->type === Token::TYPE_DELIMITER) && !empty($token->token)) { |
|
| 795 | 795 | $delimiter = $token->token; |
| 796 | 796 | $fullStatement = true; |
| 797 | 797 | break; |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | |
| 801 | 801 | // No statement was found so we return the entire query as being the |
| 802 | 802 | // remaining part. |
| 803 | - if (! $fullStatement) { |
|
| 803 | + if (!$fullStatement) { |
|
| 804 | 804 | return [ |
| 805 | 805 | null, |
| 806 | 806 | $query, |
@@ -328,7 +328,7 @@ |
||
| 328 | 328 | // This is a cheap fix for `SELECT` statements that contain `UNION`. |
| 329 | 329 | // The `ORDER BY` and `LIMIT` clauses should be at the end of the |
| 330 | 330 | // statement. |
| 331 | - if (! empty($this->union)) { |
|
| 331 | + if (!empty($this->union)) { |
|
| 332 | 332 | $clauses = static::$CLAUSES; |
| 333 | 333 | unset($clauses['ORDER BY'], $clauses['LIMIT']); |
| 334 | 334 | $clauses['ORDER BY'] = [ |