summaryrefslogtreecommitdiffstats
path: root/src/Components/Condition.php
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauriciofauth@gmail.com>2019-01-08 21:32:02 -0200
committerMaurício Meneghini Fauth <mauriciofauth@gmail.com>2019-01-16 17:21:25 -0200
commit86c5baebda24c1721fb6881df8671a3c7df60e8b (patch)
tree0a76d58ea229d1008e169b1c5b25ce90dde91808 /src/Components/Condition.php
parent28427543566b6dd32fe44db704ea41368ba55c0e (diff)
downloadsql-parser-86c5baebda24c1721fb6881df8671a3c7df60e8b.zip
sql-parser-86c5baebda24c1721fb6881df8671a3c7df60e8b.tar.gz
sql-parser-86c5baebda24c1721fb6881df8671a3c7df60e8b.tar.bz2
Apply phpmyadmin/coding-standard
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'src/Components/Condition.php')
-rw-r--r--src/Components/Condition.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/Components/Condition.php b/src/Components/Condition.php
index 2be0abd..83b80b2 100644
--- a/src/Components/Condition.php
+++ b/src/Components/Condition.php
@@ -25,14 +25,20 @@ class Condition extends Component
*
* @var array
*/
- public static $DELIMITERS = array('&&', '||', 'AND', 'OR', 'XOR');
+ public static $DELIMITERS = [
+ '&&',
+ '||',
+ 'AND',
+ 'OR',
+ 'XOR',
+ ];
/**
* List of allowed reserved keywords in conditions.
*
* @var array
*/
- public static $ALLOWED_KEYWORDS = array(
+ public static $ALLOWED_KEYWORDS = [
'ALL' => 1,
'AND' => 1,
'BETWEEN' => 1,
@@ -51,14 +57,14 @@ class Condition extends Component
'REGEXP' => 1,
'RLIKE' => 1,
'XOR' => 1,
- );
+ ];
/**
* Identifiers recognized.
*
* @var array
*/
- public $identifiers = array();
+ public $identifiers = [];
/**
* Whether this component is an operator.
@@ -91,9 +97,9 @@ class Condition extends Component
*
* @return Condition[]
*/
- public static function parse(Parser $parser, TokensList $list, array $options = array())
+ public static function parse(Parser $parser, TokensList $list, array $options = [])
{
- $ret = array();
+ $ret = [];
$expr = new self();
@@ -148,7 +154,7 @@ class Condition extends Component
} else {
// The expression ended.
$expr->expr = trim($expr->expr);
- if (!empty($expr->expr)) {
+ if (! empty($expr->expr)) {
$ret[] = $expr;
}
@@ -165,7 +171,7 @@ class Condition extends Component
if (($token->type === Token::TYPE_KEYWORD)
&& ($token->flags & Token::FLAG_KEYWORD_RESERVED)
- && !($token->flags & Token::FLAG_KEYWORD_FUNCTION)
+ && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
) {
if ($token->value === 'BETWEEN') {
$betweenBefore = true;
@@ -189,11 +195,11 @@ class Condition extends Component
$expr->expr .= $token->token;
if (($token->type === Token::TYPE_NONE)
|| (($token->type === Token::TYPE_KEYWORD)
- && (!($token->flags & Token::FLAG_KEYWORD_RESERVED)))
+ && (! ($token->flags & Token::FLAG_KEYWORD_RESERVED)))
|| ($token->type === Token::TYPE_STRING)
|| ($token->type === Token::TYPE_SYMBOL)
) {
- if (!in_array($token->value, $expr->identifiers)) {
+ if (! in_array($token->value, $expr->identifiers)) {
$expr->identifiers[] = $token->value;
}
}
@@ -201,7 +207,7 @@ class Condition extends Component
// Last iteration was not processed.
$expr->expr = trim($expr->expr);
- if (!empty($expr->expr)) {
+ if (! empty($expr->expr)) {
$ret[] = $expr;
}
@@ -216,7 +222,7 @@ class Condition extends Component
*
* @return string
*/
- public static function build($component, array $options = array())
+ public static function build($component, array $options = [])
{
if (is_array($component)) {
return implode(' ', $component);