summaryrefslogtreecommitdiffstats
path: root/src/Components/JoinKeyword.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/JoinKeyword.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/JoinKeyword.php')
-rw-r--r--src/Components/JoinKeyword.php32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/Components/JoinKeyword.php b/src/Components/JoinKeyword.php
index 786092d..6a13177 100644
--- a/src/Components/JoinKeyword.php
+++ b/src/Components/JoinKeyword.php
@@ -25,7 +25,7 @@ class JoinKeyword extends Component
*
* @var array
*/
- public static $JOINS = array(
+ public static $JOINS = [
'CROSS JOIN' => 'CROSS',
'FULL JOIN' => 'FULL',
'FULL OUTER JOIN' => 'FULL',
@@ -41,7 +41,7 @@ class JoinKeyword extends Component
'NATURAL LEFT OUTER JOIN' => 'NATURAL LEFT OUTER',
'NATURAL RIGHT OUTER JOIN' => 'NATURAL RIGHT OUTER',
'STRAIGHT_JOIN' => 'STRAIGHT',
- );
+ ];
/**
* Type of this join.
@@ -98,9 +98,9 @@ class JoinKeyword extends Component
*
* @return JoinKeyword[]
*/
- 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();
@@ -151,7 +151,7 @@ class JoinKeyword extends Component
if ($state === 0) {
if (($token->type === Token::TYPE_KEYWORD)
- && !empty(static::$JOINS[$token->keyword])
+ && ! empty(static::$JOINS[$token->keyword])
) {
$expr->type = static::$JOINS[$token->keyword];
$state = 1;
@@ -159,19 +159,19 @@ class JoinKeyword extends Component
break;
}
} elseif ($state === 1) {
- $expr->expr = Expression::parse($parser, $list, array('field' => 'table'));
+ $expr->expr = Expression::parse($parser, $list, ['field' => 'table']);
$state = 2;
} elseif ($state === 2) {
if ($token->type === Token::TYPE_KEYWORD) {
- switch($token->keyword) {
+ switch ($token->keyword) {
case 'ON':
$state = 3;
- break;
+ break;
case 'USING':
$state = 4;
- break;
+ break;
default:
- if (!empty(static::$JOINS[$token->keyword])
+ if (! empty(static::$JOINS[$token->keyword])
) {
$ret[] = $expr;
$expr = new self();
@@ -181,7 +181,7 @@ class JoinKeyword extends Component
/* Next clause is starting */
break 2;
}
- break;
+ break;
}
}
} elseif ($state === 3) {
@@ -197,7 +197,7 @@ class JoinKeyword extends Component
}
}
- if (!empty($expr->type)) {
+ if (! empty($expr->type)) {
$ret[] = $expr;
}
@@ -212,14 +212,14 @@ class JoinKeyword extends Component
*
* @return string
*/
- public static function build($component, array $options = array())
+ public static function build($component, array $options = [])
{
- $ret = array();
+ $ret = [];
foreach ($component as $c) {
$ret[] = array_search($c->type, static::$JOINS) . ' ' . $c->expr
- . (!empty($c->on)
+ . (! empty($c->on)
? ' ON ' . Condition::build($c->on) : '')
- . (!empty($c->using)
+ . (! empty($c->using)
? ' USING ' . ArrayObj::build($c->using) : '');
}