Completed
Pull Request — master (#88)
by Deven
184:10 queued 119:09
created
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.