Completed
Pull Request — master (#95)
by Deven
78:17 queued 13:28
created
src/Statements/InsertStatement.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -115,19 +115,19 @@
 block discarded – undo
115 115
      */
116 116
     public function build()
117 117
     {
118
-        $ret = 'INSERT ' . $this->options
119
-            . ' INTO ' . $this->into;
118
+        $ret = 'INSERT '.$this->options
119
+            . ' INTO '.$this->into;
120 120
 
121 121
         if ($this->values != NULL && count($this->values) > 0) {
122
-            $ret .= ' VALUES ' . Array2d::build($this->values);
122
+            $ret .= ' VALUES '.Array2d::build($this->values);
123 123
         } elseif ($this->set != NULL && count($this->set) > 0) {
124
-            $ret .= ' SET ' . SetOperation::build($this->set);
124
+            $ret .= ' SET '.SetOperation::build($this->set);
125 125
         } elseif ($this->select != NULL && count($this->select) > 0) {
126
-            $ret .= ' ' . $this->select->build();
126
+            $ret .= ' '.$this->select->build();
127 127
         }
128 128
 
129 129
         if ($this->onDuplicateSet != NULL && count($this->onDuplicateSet) > 0) {
130
-            $ret .= ' ON DUPLICATE KEY UPDATE ' . SetOperation::build($this->onDuplicateSet);
130
+            $ret .= ' ON DUPLICATE KEY UPDATE '.SetOperation::build($this->onDuplicateSet);
131 131
         }
132 132
 
133 133
         return $ret;
Please login to merge, or discard this patch.
src/Statements/ReplaceStatement.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,15 +93,15 @@
 block discarded – undo
93 93
      */
94 94
     public function build()
95 95
     {
96
-        $ret = 'REPLACE ' . $this->options
97
-            . ' INTO ' . $this->into;
96
+        $ret = 'REPLACE '.$this->options
97
+            . ' INTO '.$this->into;
98 98
 
99 99
         if ($this->values != NULL && count($this->values) > 0) {
100
-            $ret .= ' VALUES ' . Array2d::build($this->values);
100
+            $ret .= ' VALUES '.Array2d::build($this->values);
101 101
         } elseif ($this->set != NULL && count($this->set) > 0) {
102
-            $ret .= ' SET ' . SetOperation::build($this->set);
102
+            $ret .= ' SET '.SetOperation::build($this->set);
103 103
         } elseif ($this->select != NULL && count($this->select) > 0) {
104
-            $ret .= ' ' . $this->select->build();
104
+            $ret .= ' '.$this->select->build();
105 105
         }
106 106
 
107 107
         return $ret;
Please login to merge, or discard this patch.
src/Components/OptionsArray.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Utils/Formatter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Statements/DeleteStatement.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@
 block discarded – undo
302 302
                     ++$list->idx; // Skip 'ORDER  BY'
303 303
                     $this->order = OrderKeyword::parse($parser, $list);
304 304
                     $state = 5;
305
-                }  elseif ($token->type === Token::TYPE_KEYWORD
305
+                } elseif ($token->type === Token::TYPE_KEYWORD
306 306
                     && $token->value === 'LIMIT'
307 307
                 ) {
308 308
                     ++$list->idx; // Skip 'LIMIT'
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Components/Limit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,6 +127,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Components/CaseExpression.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
      * @param Parser     $parser  The parser that serves as context.
78 78
      * @param TokensList $list    The list of tokens that are being parsed.
79 79
      *
80
-     * @return Expression
80
+     * @return CaseExpression
81 81
      */
82 82
     public static function parse(Parser $parser, TokensList $list)
83 83
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
tools/ContextGenerator.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -52,46 +52,46 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Components/JoinKeyword.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -183,11 +183,11 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.