@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $state = 3; |
| 163 | 163 | } elseif (($token->value === ',') || ($token->value === ')')) { |
| 164 | 164 | $state = ($token->value === ',') ? 2 : 4; |
| 165 | - if (! empty($lastColumn)) { |
|
| 165 | + if (!empty($lastColumn)) { |
|
| 166 | 166 | $ret->columns[] = $lastColumn; |
| 167 | 167 | $lastColumn = array(); |
| 168 | 168 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | public static function build($component, array $options = array()) |
| 198 | 198 | { |
| 199 | 199 | $ret = $component->type . ' '; |
| 200 | - if (! empty($component->name)) { |
|
| 200 | + if (!empty($component->name)) { |
|
| 201 | 201 | $ret .= Context::escape($component->name) . ' '; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | 200 | // When a field is parsed, no parentheses are expected. |
| 201 | - if (! empty($options['parseField'])) { |
|
| 201 | + if (!empty($options['parseField'])) { |
|
| 202 | 202 | $options['breakOnParentheses'] = true; |
| 203 | 203 | $options['field'] = $options['parseField']; |
| 204 | 204 | } |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | if ($token->type === Token::TYPE_KEYWORD) { |
| 230 | 230 | if (($brackets > 0) && empty($ret->subquery) |
| 231 | - && ! empty(Parser::$STATEMENT_PARSERS[$token->keyword]) |
|
| 231 | + && !empty(Parser::$STATEMENT_PARSERS[$token->keyword]) |
|
| 232 | 232 | ) { |
| 233 | 233 | // A `(` was previously found and this keyword is the |
| 234 | 234 | // beginning of a statement, so this is a subquery. |
| 235 | 235 | $ret->subquery = $token->keyword; |
| 236 | 236 | } elseif (($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
| 237 | 237 | && (empty($options['parseField']) |
| 238 | - && ! $alias) |
|
| 238 | + && !$alias) |
|
| 239 | 239 | ) { |
| 240 | 240 | $isExpr = true; |
| 241 | 241 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | break; |
| 249 | 249 | } |
| 250 | 250 | if ($token->keyword === 'AS') { |
| 251 | - if (! empty($options['breakOnAlias'])) { |
|
| 251 | + if (!empty($options['breakOnAlias'])) { |
|
| 252 | 252 | break; |
| 253 | 253 | } |
| 254 | 254 | if ($alias) { |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | continue; |
| 270 | 270 | } |
| 271 | 271 | $isExpr = true; |
| 272 | - } elseif ($brackets === 0 && strlen($ret->expr) > 0 && ! $alias) { |
|
| 272 | + } elseif ($brackets === 0 && strlen($ret->expr) > 0 && !$alias) { |
|
| 273 | 273 | /* End of expression */ |
| 274 | 274 | break; |
| 275 | 275 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | || (($token->type === Token::TYPE_OPERATOR) |
| 285 | 285 | && ($token->value !== '.')) |
| 286 | 286 | ) { |
| 287 | - if (! empty($options['parseField'])) { |
|
| 287 | + if (!empty($options['parseField'])) { |
|
| 288 | 288 | break; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | if ($token->type === Token::TYPE_OPERATOR) { |
| 297 | - if (! empty($options['breakOnParentheses']) |
|
| 297 | + if (!empty($options['breakOnParentheses']) |
|
| 298 | 298 | && (($token->value === '(') || ($token->value === ')')) |
| 299 | 299 | ) { |
| 300 | 300 | // No brackets were expected. |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } else { |
| 318 | 318 | --$brackets; |
| 319 | 319 | if ($brackets === 0) { |
| 320 | - if (! empty($options['parenthesesDelimited'])) { |
|
| 320 | + if (!empty($options['parenthesesDelimited'])) { |
|
| 321 | 321 | // The current token is the last bracket, the next |
| 322 | 322 | // one will be outside the expression. |
| 323 | 323 | $ret->expr .= $token->token; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | if ($alias) { |
| 346 | 346 | // An alias is expected (the keyword `AS` was previously found). |
| 347 | - if (! empty($ret->alias)) { |
|
| 347 | + if (!empty($ret->alias)) { |
|
| 348 | 348 | $parser->error('An alias was previously found.', $token); |
| 349 | 349 | break; |
| 350 | 350 | } |
@@ -357,13 +357,13 @@ discard block |
||
| 357 | 357 | || ((($prev[0]->type !== Token::TYPE_OPERATOR) |
| 358 | 358 | || ($prev[0]->token === ')')) |
| 359 | 359 | && (($prev[0]->type !== Token::TYPE_KEYWORD) |
| 360 | - || (! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))) |
|
| 360 | + || (!($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))) |
|
| 361 | 361 | && (($prev[1]->type === Token::TYPE_STRING) |
| 362 | 362 | || (($prev[1]->type === Token::TYPE_SYMBOL) |
| 363 | - && (! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))) |
|
| 363 | + && (!($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))) |
|
| 364 | 364 | || ($prev[1]->type === Token::TYPE_NONE)) |
| 365 | 365 | ) { |
| 366 | - if (! empty($ret->alias)) { |
|
| 366 | + if (!empty($ret->alias)) { |
|
| 367 | 367 | $parser->error('An alias was previously found.', $token); |
| 368 | 368 | break; |
| 369 | 369 | } |
@@ -371,12 +371,12 @@ discard block |
||
| 371 | 371 | } else { |
| 372 | 372 | $ret->expr .= $token->token; |
| 373 | 373 | } |
| 374 | - } elseif (! $isExpr) { |
|
| 374 | + } elseif (!$isExpr) { |
|
| 375 | 375 | if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '.')) { |
| 376 | 376 | // Found a `.` which means we expect a column name and |
| 377 | 377 | // the column name we parsed is actually the table name |
| 378 | 378 | // and the table name is actually a database name. |
| 379 | - if (! empty($ret->database) || $dot) { |
|
| 379 | + if (!empty($ret->database) || $dot) { |
|
| 380 | 380 | $parser->error('Unexpected dot.', $token); |
| 381 | 381 | } |
| 382 | 382 | $ret->database = $ret->table; |
@@ -392,10 +392,10 @@ discard block |
||
| 392 | 392 | $dot = false; |
| 393 | 393 | } else { |
| 394 | 394 | // No alias is expected. |
| 395 | - if (! empty($options['breakOnAlias'])) { |
|
| 395 | + if (!empty($options['breakOnAlias'])) { |
|
| 396 | 396 | break; |
| 397 | 397 | } |
| 398 | - if (! empty($ret->alias)) { |
|
| 398 | + if (!empty($ret->alias)) { |
|
| 399 | 399 | $parser->error('An alias was previously found.', $token); |
| 400 | 400 | break; |
| 401 | 401 | } |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | return implode(', ', $component); |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - if ($component->expr !== '' && ! is_null($component->expr)) { |
|
| 439 | + if ($component->expr !== '' && !is_null($component->expr)) { |
|
| 440 | 440 | $ret = $component->expr; |
| 441 | 441 | } else { |
| 442 | 442 | $fields = array(); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $ret = implode('.', Context::escape($fields)); |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - if (! empty($component->alias)) { |
|
| 455 | + if (!empty($component->alias)) { |
|
| 456 | 456 | $ret .= ' AS ' . Context::escape($component->alias); |
| 457 | 457 | } |
| 458 | 458 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | // Handle optional AS keyword before alias |
| 228 | 228 | if ($token->type === Token::TYPE_KEYWORD |
| 229 | 229 | && $token->keyword === 'AS') { |
| 230 | - if ($asFound || ! empty($ret->alias)) { |
|
| 230 | + if ($asFound || !empty($ret->alias)) { |
|
| 231 | 231 | $parser->error('Potential duplicate alias of CASE expression.', $token); |
| 232 | 232 | break; |
| 233 | 233 | } |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | if ($asFound |
| 247 | 247 | || $token->type === Token::TYPE_STRING |
| 248 | - || ($token->type === Token::TYPE_SYMBOL && ! $token->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
| 248 | + || ($token->type === Token::TYPE_SYMBOL && !$token->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
| 249 | 249 | || $token->type === Token::TYPE_NONE |
| 250 | 250 | ) { |
| 251 | 251 | // An alias is expected (the keyword `AS` was previously found). |
| 252 | - if (! empty($ret->alias)) { |
|
| 252 | + if (!empty($ret->alias)) { |
|
| 253 | 253 | $parser->error('An alias was previously found.', $token); |
| 254 | 254 | break; |
| 255 | 255 | } |
@@ -180,7 +180,7 @@ |
||
| 180 | 180 | { |
| 181 | 181 | if (is_array($component)) { |
| 182 | 182 | return implode(', ', $component); |
| 183 | - } elseif (! empty($component->raw)) { |
|
| 183 | + } elseif (!empty($component->raw)) { |
|
| 184 | 184 | return '(' . implode(', ', $component->raw) . ')'; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | if ($state === 0) { |
| 130 | 130 | $ret->name = strtoupper($token->value); |
| 131 | - if (($token->type !== Token::TYPE_KEYWORD) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
| 131 | + if (($token->type !== Token::TYPE_KEYWORD) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
| 132 | 132 | $parser->error('Unrecognized data type.', $token); |
| 133 | 133 | } |
| 134 | 134 | $state = 1; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $component->name : strtolower($component->name); |
| 167 | 167 | |
| 168 | 168 | $parameters = ''; |
| 169 | - if (! empty($component->parameters)) { |
|
| 169 | + if (!empty($component->parameters)) { |
|
| 170 | 170 | $parameters = '(' . implode(',', $component->parameters) . ')'; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | if ($state === 0) { |
| 159 | - if (! is_array($lastOption)) { |
|
| 159 | + if (!is_array($lastOption)) { |
|
| 160 | 160 | // This is a just keyword option without any value. |
| 161 | 161 | // This is the beginning and the end of it. |
| 162 | 162 | $ret->options[$lastOptionId] = $token->value; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | $ret->options[$lastOptionId]['expr'] .= $token->token; |
| 228 | 228 | |
| 229 | - if (! ((($token->token === '(') && ($brackets === 1)) |
|
| 229 | + if (!((($token->token === '(') && ($brackets === 1)) |
|
| 230 | 230 | || (($token->token === ')') && ($brackets === 0))) |
| 231 | 231 | ) { |
| 232 | 232 | // First pair of brackets is being skipped. |
@@ -284,12 +284,12 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $options = array(); |
| 286 | 286 | foreach ($component->options as $option) { |
| 287 | - if (! is_array($option)) { |
|
| 287 | + if (!is_array($option)) { |
|
| 288 | 288 | $options[] = $option; |
| 289 | 289 | } else { |
| 290 | 290 | $options[] = $option['name'] |
| 291 | - . ((! empty($option['equals']) && $option['equals']) ? '=' : ' ') |
|
| 292 | - . (! empty($option['expr']) ? $option['expr'] : $option['value']); |
|
| 291 | + . ((!empty($option['equals']) && $option['equals']) ? '=' : ' ') |
|
| 292 | + . (!empty($option['expr']) ? $option['expr'] : $option['value']); |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
@@ -309,10 +309,10 @@ discard block |
||
| 309 | 309 | { |
| 310 | 310 | foreach ($this->options as $option) { |
| 311 | 311 | if (is_array($option)) { |
| 312 | - if (! strcasecmp($key, $option['name'])) { |
|
| 312 | + if (!strcasecmp($key, $option['name'])) { |
|
| 313 | 313 | return $getExpr ? $option['expr'] : $option['value']; |
| 314 | 314 | } |
| 315 | - } elseif (! strcasecmp($key, $option)) { |
|
| 315 | + } elseif (!strcasecmp($key, $option)) { |
|
| 316 | 316 | return true; |
| 317 | 317 | } |
| 318 | 318 | } |
@@ -331,12 +331,12 @@ discard block |
||
| 331 | 331 | { |
| 332 | 332 | foreach ($this->options as $idx => $option) { |
| 333 | 333 | if (is_array($option)) { |
| 334 | - if (! strcasecmp($key, $option['name'])) { |
|
| 334 | + if (!strcasecmp($key, $option['name'])) { |
|
| 335 | 335 | unset($this->options[$idx]); |
| 336 | 336 | |
| 337 | 337 | return true; |
| 338 | 338 | } |
| 339 | - } elseif (! strcasecmp($key, $option)) { |
|
| 339 | + } elseif (!strcasecmp($key, $option)) { |
|
| 340 | 340 | unset($this->options[$idx]); |
| 341 | 341 | |
| 342 | 342 | return true; |
@@ -160,7 +160,7 @@ |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $tmp = ''; |
| 163 | - if (! empty($component->inOut)) { |
|
| 163 | + if (!empty($component->inOut)) { |
|
| 164 | 164 | $tmp .= $component->inOut . ' '; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $state = 4; |
| 245 | 245 | } elseif ($token->type === Token::TYPE_SYMBOL || $token->type === Token::TYPE_NONE) { |
| 246 | 246 | $expr->name = $token->value; |
| 247 | - if (! $expr->isConstraint) { |
|
| 247 | + if (!$expr->isConstraint) { |
|
| 248 | 248 | $state = 2; |
| 249 | 249 | } |
| 250 | 250 | } elseif ($token->type === Token::TYPE_KEYWORD) { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | $state = 5; |
| 289 | 289 | } elseif ($state === 5) { |
| 290 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
| 290 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
| 291 | 291 | $ret[] = $expr; |
| 292 | 292 | } |
| 293 | 293 | $expr = new self(); |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // Last iteration was not saved. |
| 312 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
| 312 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
| 313 | 313 | $ret[] = $expr; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -347,18 +347,18 @@ discard block |
||
| 347 | 347 | $tmp .= Context::escape($component->name) . ' '; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if (! empty($component->type)) { |
|
| 350 | + if (!empty($component->type)) { |
|
| 351 | 351 | $tmp .= DataType::build( |
| 352 | 352 | $component->type, |
| 353 | 353 | array('lowercase' => true) |
| 354 | 354 | ) . ' '; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - if (! empty($component->key)) { |
|
| 357 | + if (!empty($component->key)) { |
|
| 358 | 358 | $tmp .= $component->key . ' '; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if (! empty($component->references)) { |
|
| 361 | + if (!empty($component->references)) { |
|
| 362 | 362 | $tmp .= 'REFERENCES ' . $component->references . ' '; |
| 363 | 363 | } |
| 364 | 364 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } elseif (($token->type === Token::TYPE_OPERATOR) |
| 94 | 94 | && ($token->value === ',') |
| 95 | 95 | ) { |
| 96 | - if (! empty($expr->expr)) { |
|
| 96 | + if (!empty($expr->expr)) { |
|
| 97 | 97 | $ret[] = $expr; |
| 98 | 98 | } |
| 99 | 99 | $expr = new self(); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Last iteration was not processed. |
| 108 | - if (! empty($expr->expr)) { |
|
| 108 | + if (!empty($expr->expr)) { |
|
| 109 | 109 | $ret[] = $expr; |
| 110 | 110 | } |
| 111 | 111 | |