Passed
Push — master ( 101b9a...e7ce0a )
by David
04:07 queued 11s
created
lib/Dwoo/Compiler.php 2 patches
Spacing   +384 added lines, -386 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      */
295 295
     public function setNestedCommentsHandling($allow = true)
296 296
     {
297
-        $this->allowNestedComments = (bool)$allow;
297
+        $this->allowNestedComments = (bool) $allow;
298 298
     }
299 299
 
300 300
     /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      */
320 320
     public function setLooseOpeningHandling($allow = false)
321 321
     {
322
-        $this->allowLooseOpenings = (bool)$allow;
322
+        $this->allowLooseOpenings = (bool) $allow;
323 323
     }
324 324
 
325 325
     /**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      */
345 345
     public function setAutoEscape($enabled)
346 346
     {
347
-        $this->autoEscape = (bool)$enabled;
347
+        $this->autoEscape = (bool) $enabled;
348 348
     }
349 349
 
350 350
     /**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
     {
372 372
         if ($autoload) {
373 373
             $name  = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', Core::toCamelCase($callback));
374
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . $name;
374
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.$name;
375 375
 
376 376
             if (class_exists($class)) {
377 377
                 $callback = array(new $class($this), 'process');
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
     {
397 397
         if (($index = array_search($callback, $this->processors['pre'], true)) !== false) {
398 398
             unset($this->processors['pre'][$index]);
399
-        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
399
+        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
400 400
                     $callback),
401 401
                 $this->processors['pre'], true)) !== false) {
402 402
             unset($this->processors['pre'][$index]);
403 403
         } else {
404
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
404
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
405 405
             foreach ($this->processors['pre'] as $index => $proc) {
406 406
                 if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) {
407 407
                     unset($this->processors['pre'][$index]);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     {
425 425
         if ($autoload) {
426 426
             $name  = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
427
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . Core::toCamelCase($name);
427
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.Core::toCamelCase($name);
428 428
 
429 429
             if (class_exists($class)) {
430 430
                 $callback = array(new $class($this), 'process');
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
     {
450 450
         if (($index = array_search($callback, $this->processors['post'], true)) !== false) {
451 451
             unset($this->processors['post'][$index]);
452
-        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
452
+        } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '',
453 453
                     $callback),
454 454
                 $this->processors['post'], true)) !== false) {
455 455
             unset($this->processors['post'][$index]);
456 456
         } else {
457
-            $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
457
+            $class = Core::NAMESPACE_PLUGINS_PROCESSORS.str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback);
458 458
             foreach ($this->processors['post'] as $index => $proc) {
459 459
                 if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) {
460 460
                     unset($this->processors['post'][$index]);
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                 $this->getCore()->getLoader()->loadPlugin($name);
481 481
             }
482 482
             catch (Exception $e) {
483
-                throw new Exception('Processor ' . $name . ' could not be found in your plugin directories, please ensure it is in a file named ' . $name . '.php in the plugin directory');
483
+                throw new Exception('Processor '.$name.' could not be found in your plugin directories, please ensure it is in a file named '.$name.'.php in the plugin directory');
484 484
             }
485 485
         }
486 486
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     public function setTemplateSource($newSource, $fromPointer = false)
667 667
     {
668 668
         if ($fromPointer === true) {
669
-            $this->templateSource = substr($this->templateSource, 0, $this->pointer) . $newSource;
669
+            $this->templateSource = substr($this->templateSource, 0, $this->pointer).$newSource;
670 670
         } else {
671 671
             $this->templateSource = $newSource;
672 672
         }
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
 
738 738
                 if ($this->debug) {
739 739
                     echo "\n";
740
-                    echo 'COMPILER INIT' . "\n";
740
+                    echo 'COMPILER INIT'."\n";
741 741
                 }
742 742
 
743 743
                 if ($this->debug) {
744
-                    echo 'PROCESSING PREPROCESSORS (' . count($this->processors['pre']) . ')' . "\n";
744
+                    echo 'PROCESSING PREPROCESSORS ('.count($this->processors['pre']).')'."\n";
745 745
                 }
746 746
 
747 747
                 // runs preprocessors
@@ -785,23 +785,23 @@  discard block
 block discarded – undo
785 785
             if ($pos === false) {
786 786
                 $this->push(substr($tpl, $ptr), 0);
787 787
                 break;
788
-            } elseif (substr($tpl, $pos - 1, 1) === '\\' && substr($tpl, $pos - 2, 1) !== '\\') {
789
-                $this->push(substr($tpl, $ptr, $pos - $ptr - 1) . $this->ld);
790
-                $ptr = $pos + strlen($this->ld);
791
-            } elseif (preg_match('/^' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . 'literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', substr($tpl, $pos), $litOpen)) {
792
-                if (!preg_match('/' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . '\/literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
788
+            } elseif (substr($tpl, $pos-1, 1) === '\\' && substr($tpl, $pos-2, 1) !== '\\') {
789
+                $this->push(substr($tpl, $ptr, $pos-$ptr-1).$this->ld);
790
+                $ptr = $pos+strlen($this->ld);
791
+            } elseif (preg_match('/^'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', substr($tpl, $pos), $litOpen)) {
792
+                if (!preg_match('/'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'\/literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
793 793
                     throw new CompilationException($this, 'The {literal} blocks must be closed explicitly with {/literal}');
794 794
                 }
795 795
                 $endpos = $litClose[0][1];
796
-                $this->push(substr($tpl, $ptr, $pos - $ptr) . substr($tpl, $pos + strlen($litOpen[0]), $endpos - $pos - strlen($litOpen[0])));
797
-                $ptr = $endpos + strlen($litClose[0][0]);
796
+                $this->push(substr($tpl, $ptr, $pos-$ptr).substr($tpl, $pos+strlen($litOpen[0]), $endpos-$pos-strlen($litOpen[0])));
797
+                $ptr = $endpos+strlen($litClose[0][0]);
798 798
             } else {
799
-                if (substr($tpl, $pos - 2, 1) === '\\' && substr($tpl, $pos - 1, 1) === '\\') {
800
-                    $this->push(substr($tpl, $ptr, $pos - $ptr - 1));
799
+                if (substr($tpl, $pos-2, 1) === '\\' && substr($tpl, $pos-1, 1) === '\\') {
800
+                    $this->push(substr($tpl, $ptr, $pos-$ptr-1));
801 801
                     $ptr = $pos;
802 802
                 }
803 803
 
804
-                $this->push(substr($tpl, $ptr, $pos - $ptr));
804
+                $this->push(substr($tpl, $ptr, $pos-$ptr));
805 805
                 $ptr = $pos;
806 806
 
807 807
                 $pos += strlen($this->ld);
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 
820 820
                 // check that there is an end tag present
821 821
                 if (strpos($tpl, $this->rd, $pos) === false) {
822
-                    throw new CompilationException($this, 'A template tag was not closed, started with "' . substr($tpl, $ptr, 30) . '"');
822
+                    throw new CompilationException($this, 'A template tag was not closed, started with "'.substr($tpl, $ptr, 30).'"');
823 823
                 }
824 824
 
825 825
                 $ptr += strlen($this->ld);
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                         continue 2;
834 834
                     }
835 835
 
836
-                    $len = $subptr - $ptr;
836
+                    $len = $subptr-$ptr;
837 837
                     $this->push($parsed, substr_count(substr($tpl, $ptr, $len), "\n"));
838 838
                     $ptr += $len;
839 839
 
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
         $compiled .= $this->removeBlock('TopLevelBlock');
848 848
 
849 849
         if ($this->debug) {
850
-            echo 'PROCESSING POSTPROCESSORS' . "\n";
850
+            echo 'PROCESSING POSTPROCESSORS'."\n";
851 851
         }
852 852
 
853 853
         foreach ($this->processors['post'] as $postProc) {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
         unset($postProc);
864 864
 
865 865
         if ($this->debug) {
866
-            echo 'COMPILATION COMPLETE : MEM USAGE : ' . memory_get_usage() . "\n";
866
+            echo 'COMPILATION COMPLETE : MEM USAGE : '.memory_get_usage()."\n";
867 867
         }
868 868
 
869 869
         $output = "<?php\n/* template head */\n";
@@ -876,30 +876,30 @@  discard block
 block discarded – undo
876 876
 
877 877
             switch ($type) {
878 878
                 case Core::CLASS_PLUGIN:
879
-                case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN:
880
-                    if (class_exists('Plugin' . $plugin) !== false) {
881
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
879
+                case Core::CLASS_PLUGIN+Core::BLOCK_PLUGIN:
880
+                    if (class_exists('Plugin'.$plugin) !== false) {
881
+                        $output .= "if (class_exists('"."Plugin".$plugin."')===false)".
882 882
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
883 883
                     } else {
884
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)".
884
+                        $output .= "if (class_exists('".Core::NAMESPACE_PLUGINS_BLOCKS."Plugin".$plugin."')===false)".
885 885
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
886 886
                     }
887 887
                     break;
888
-                case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN:
889
-                    if (class_exists('Plugin' . $plugin) !== false) {
890
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
888
+                case Core::CLASS_PLUGIN+Core::FUNC_PLUGIN:
889
+                    if (class_exists('Plugin'.$plugin) !== false) {
890
+                        $output .= "if (class_exists('"."Plugin".$plugin."')===false)".
891 891
                             "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
892 892
                     } else {
893
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
893
+                        $output .= "if (class_exists('".Core::NAMESPACE_PLUGINS_FUNCTIONS."Plugin".$plugin."')===false)".
894 894
                             "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
895 895
                     }
896 896
                     break;
897 897
                 case Core::FUNC_PLUGIN:
898
-                    if (function_exists('Plugin' . $plugin) !== false) {
899
-                        $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
898
+                    if (function_exists('Plugin'.$plugin) !== false) {
899
+                        $output .= "if (function_exists('"."Plugin".$plugin."')===false)".
900 900
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
901 901
                     } else {
902
-                        $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
902
+                        $output .= "if (function_exists('".Core::NAMESPACE_PLUGINS_FUNCTIONS."Plugin".$plugin."')===false)".
903 903
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
904 904
                     }
905 905
                     break;
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
                     $output .= $this->getCore()->getPluginProxy()->getLoader($plugin);
920 920
                     break;
921 921
                 default:
922
-                    throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
922
+                    throw new CompilationException($this, 'Type error for '.$plugin.' with type'.$type);
923 923
             }
924 924
         }
925 925
 
@@ -930,30 +930,30 @@  discard block
 block discarded – undo
930 930
         }
931 931
         foreach ($this->templatePlugins as $function) {
932 932
             if (isset($function['called']) && $function['called'] === true) {
933
-                $output .= $function['body'] . PHP_EOL;
933
+                $output .= $function['body'].PHP_EOL;
934 934
             }
935 935
         }
936 936
 
937
-        $output .= $compiled . "\n?>";
937
+        $output .= $compiled."\n?>";
938 938
 
939
-        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*' . preg_quote(self::PHP_CLOSE, '/') . preg_quote(self::PHP_OPEN, '/') . ')/', ";\n", $output);
940
-        $output = str_replace(self::PHP_CLOSE . self::PHP_OPEN, "\n", $output);
939
+        $output = preg_replace('/(?<!;|\}|\*\/|\n|\{)(\s*'.preg_quote(self::PHP_CLOSE, '/').preg_quote(self::PHP_OPEN, '/').')/', ";\n", $output);
940
+        $output = str_replace(self::PHP_CLOSE.self::PHP_OPEN, "\n", $output);
941 941
 
942 942
         // handle <?xml tag at the beginning
943 943
         $output = preg_replace('#(/\* template body \*/ \?>\s*)<\?xml#is', '$1<?php echo \'<?xml\'; ?>', $output);
944 944
 
945 945
         // add another line break after PHP closing tags that have a line break following,
946 946
         // as we do not know whether it's intended, and PHP will strip it otherwise
947
-        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0' . "\n", $output);
947
+        $output = preg_replace('/(?<!"|<\?xml)\s*\?>\n/', '$0'."\n", $output);
948 948
 
949 949
         if ($this->debug) {
950
-            echo '=============================================================================================' . "\n";
950
+            echo '============================================================================================='."\n";
951 951
             $lines = preg_split('{\r\n|\n|<br />}', $output);
952 952
             array_shift($lines);
953 953
             foreach ($lines as $i => $line) {
954
-                echo ($i + 1) . '. ' . $line . "\r\n";
954
+                echo ($i+1).'. '.$line."\r\n";
955 955
             }
956
-            echo '=============================================================================================' . "\n";
956
+            echo '============================================================================================='."\n";
957 957
         }
958 958
 
959 959
         $this->template = $this->dwoo = null;
@@ -970,13 +970,13 @@  discard block
 block discarded – undo
970 970
     protected function resolveSubTemplateDependencies($function)
971 971
     {
972 972
         if ($this->debug) {
973
-            echo 'Compiler::' . __FUNCTION__ . "\n";
973
+            echo 'Compiler::'.__FUNCTION__."\n";
974 974
         }
975 975
 
976 976
         $body = $this->templatePlugins[$function]['body'];
977 977
         foreach ($this->templatePlugins as $func => $attr) {
978
-            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS .
979
-            'Plugin' . Core::toCamelCase($func)) !== false) {
978
+            if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS.
979
+            'Plugin'.Core::toCamelCase($func)) !== false) {
980 980
                 $this->templatePlugins[$func]['called'] = true;
981 981
                 $this->resolveSubTemplateDependencies($func);
982 982
             }
@@ -1000,14 +1000,14 @@  discard block
 block discarded – undo
1000 1000
 
1001 1001
         if ($this->curBlock['buffer'] === null && count($this->stack) > 1) {
1002 1002
             // buffer is not initialized yet (the block has just been created)
1003
-            $this->stack[count($this->stack) - 2]['buffer'] .= (string)$content;
1003
+            $this->stack[count($this->stack)-2]['buffer'] .= (string) $content;
1004 1004
             $this->curBlock['buffer'] = '';
1005 1005
         } else {
1006 1006
             if (!isset($this->curBlock['buffer'])) {
1007 1007
                 throw new CompilationException($this, 'The template has been closed too early, you probably have an extra block-closing tag somewhere');
1008 1008
             }
1009 1009
             // append current content to current block's buffer
1010
-            $this->curBlock['buffer'] .= (string)$content;
1010
+            $this->curBlock['buffer'] .= (string) $content;
1011 1011
         }
1012 1012
         $this->line += $lineCount;
1013 1013
     }
@@ -1077,26 +1077,26 @@  discard block
 block discarded – undo
1077 1077
     public function addBlock($type, array $params, $paramtype)
1078 1078
     {
1079 1079
         if ($this->debug) {
1080
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1080
+            echo 'Compiler::'.__FUNCTION__."\n";
1081 1081
         }
1082 1082
 
1083 1083
         $class = current(array_filter([
1084
-            'Plugin' . Core::toCamelCase($type),
1085
-            Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type)
1084
+            'Plugin'.Core::toCamelCase($type),
1085
+            Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type)
1086 1086
         ], 'class_exists'));
1087 1087
         if (false === $class) {
1088 1088
             $this->getCore()->getLoader()->loadPlugin($type);
1089 1089
         }
1090 1090
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1091 1091
 
1092
-        $this->stack[]  = array(
1092
+        $this->stack[] = array(
1093 1093
             'type'   => $type,
1094 1094
             'params' => $params,
1095 1095
             'custom' => false,
1096 1096
             'class'  => $class,
1097 1097
             'buffer' => null
1098 1098
         );
1099
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1099
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1100 1100
 
1101 1101
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1102 1102
     }
@@ -1121,14 +1121,14 @@  discard block
 block discarded – undo
1121 1121
 
1122 1122
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1123 1123
 
1124
-        $this->stack[]  = array(
1124
+        $this->stack[] = array(
1125 1125
             'type'   => $type,
1126 1126
             'params' => $params,
1127 1127
             'custom' => true,
1128 1128
             'class'  => $class,
1129 1129
             'buffer' => null
1130 1130
         );
1131
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1131
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1132 1132
 
1133 1133
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1134 1134
     }
@@ -1143,21 +1143,21 @@  discard block
 block discarded – undo
1143 1143
     public function injectBlock($type, array $params)
1144 1144
     {
1145 1145
         if ($this->debug) {
1146
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1146
+            echo 'Compiler::'.__FUNCTION__."\n";
1147 1147
         }
1148 1148
 
1149
-        $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type);
1149
+        $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($type);
1150 1150
         if (class_exists($class) === false) {
1151 1151
             $this->getCore()->getLoader()->loadPlugin($type);
1152 1152
         }
1153
-        $this->stack[]  = array(
1153
+        $this->stack[] = array(
1154 1154
             'type'   => $type,
1155 1155
             'params' => $params,
1156 1156
             'custom' => false,
1157 1157
             'class'  => $class,
1158 1158
             'buffer' => null
1159 1159
         );
1160
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1160
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1161 1161
     }
1162 1162
 
1163 1163
     /**
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
     public function removeBlock($type)
1173 1173
     {
1174 1174
         if ($this->debug) {
1175
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1175
+            echo 'Compiler::'.__FUNCTION__."\n";
1176 1176
         }
1177 1177
 
1178 1178
         $output = '';
@@ -1187,12 +1187,12 @@  discard block
 block discarded – undo
1187 1187
                     $class = $top['class'];
1188 1188
                 } else {
1189 1189
                     $class = current(array_filter([
1190
-                        'Plugin' . Core::toCamelCase($top['type']),
1191
-                        Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($top['type'])
1190
+                        'Plugin'.Core::toCamelCase($top['type']),
1191
+                        Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($top['type'])
1192 1192
                     ], 'class_exists'));
1193 1193
                 }
1194 1194
                 if (count($this->stack)) {
1195
-                    $this->curBlock = &$this->stack[count($this->stack) - 1];
1195
+                    $this->curBlock = &$this->stack[count($this->stack)-1];
1196 1196
                     $this->push(call_user_func(array(
1197 1197
                         $class,
1198 1198
                         'postProcessing'
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
                 }
1214 1214
             }
1215 1215
 
1216
-            throw new CompilationException($this, 'Syntax malformation, a block of type "' . $type . '" was closed but was not opened');
1216
+            throw new CompilationException($this, 'Syntax malformation, a block of type "'.$type.'" was closed but was not opened');
1217 1217
         }
1218 1218
 
1219 1219
         return $output;
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
             }
1252 1252
         }
1253 1253
 
1254
-        throw new CompilationException($this, 'A parent block of type "' . $type . '" is required and can not be found');
1254
+        throw new CompilationException($this, 'A parent block of type "'.$type.'" is required and can not be found');
1255 1255
     }
1256 1256
 
1257 1257
     /**
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
     public function removeTopBlock()
1275 1275
     {
1276 1276
         if ($this->debug) {
1277
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1277
+            echo 'Compiler::'.__FUNCTION__."\n";
1278 1278
         }
1279 1279
 
1280 1280
         $o = array_pop($this->stack);
@@ -1284,10 +1284,10 @@  discard block
 block discarded – undo
1284 1284
         if ($o['custom']) {
1285 1285
             $class = $o['class'];
1286 1286
         } else {
1287
-            $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($o['type']);
1287
+            $class = Core::NAMESPACE_PLUGINS_BLOCKS.'Plugin'.Core::toCamelCase($o['type']);
1288 1288
         }
1289 1289
 
1290
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1290
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1291 1291
 
1292 1292
         return call_user_func(array($class, 'postProcessing'), $this, $o['params'], '', '', $o['buffer']);
1293 1293
     }
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
     protected function parse($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1367 1367
     {
1368 1368
         if ($this->debug) {
1369
-            echo 'Compiler::' . __FUNCTION__ . "\n";
1369
+            echo 'Compiler::'.__FUNCTION__."\n";
1370 1370
         }
1371 1371
 
1372 1372
         if ($to === null) {
@@ -1383,14 +1383,14 @@  discard block
 block discarded – undo
1383 1383
                 // end template tag
1384 1384
                 $pointer += strlen($this->rd);
1385 1385
                 if ($this->debug) {
1386
-                    echo 'TEMPLATE PARSING ENDED' . "\n";
1386
+                    echo 'TEMPLATE PARSING ENDED'."\n";
1387 1387
                 }
1388 1388
 
1389 1389
                 return false;
1390 1390
             }
1391
-            ++ $from;
1391
+            ++$from;
1392 1392
             if ($pointer !== null) {
1393
-                ++ $pointer;
1393
+                ++$pointer;
1394 1394
             }
1395 1395
             if ($from >= $to) {
1396 1396
                 if (is_array($parsingParams)) {
@@ -1402,22 +1402,22 @@  discard block
 block discarded – undo
1402 1402
             $first = $in[$from];
1403 1403
         }
1404 1404
 
1405
-        $substr = substr($in, $from, $to - $from);
1405
+        $substr = substr($in, $from, $to-$from);
1406 1406
 
1407 1407
         if ($this->debug) {
1408
-            echo 'PARSE CALL : PARSING "' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . '" @ ' . $from . ':' . $to . ' in ' . $curBlock . ' : pointer=' . $pointer . "\n";
1408
+            echo 'PARSE CALL : PARSING "'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').'" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1409 1409
         }
1410 1410
         $parsed = '';
1411 1411
 
1412 1412
         if ($curBlock === 'root' && $first === '*') {
1413 1413
             $src      = $this->getTemplateSource();
1414
-            $startpos = $this->getPointer() - strlen($this->ld);
1414
+            $startpos = $this->getPointer()-strlen($this->ld);
1415 1415
             if (substr($src, $startpos, strlen($this->ld)) === $this->ld) {
1416 1416
                 if ($startpos > 0) {
1417 1417
                     do {
1418 1418
                         $char = substr($src, -- $startpos, 1);
1419 1419
                         if ($char == "\n") {
1420
-                            ++ $startpos;
1420
+                            ++$startpos;
1421 1421
                             $whitespaceStart = true;
1422 1422
                             break;
1423 1423
                         }
@@ -1428,12 +1428,12 @@  discard block
 block discarded – undo
1428 1428
                 if (!isset($whitespaceStart)) {
1429 1429
                     $startpos = $this->getPointer();
1430 1430
                 } else {
1431
-                    $pointer -= $this->getPointer() - $startpos;
1431
+                    $pointer -= $this->getPointer()-$startpos;
1432 1432
                 }
1433 1433
 
1434
-                if ($this->allowNestedComments && strpos($src, $this->ld . '*', $this->getPointer()) !== false) {
1435
-                    $comOpen  = $this->ld . '*';
1436
-                    $comClose = '*' . $this->rd;
1434
+                if ($this->allowNestedComments && strpos($src, $this->ld.'*', $this->getPointer()) !== false) {
1435
+                    $comOpen  = $this->ld.'*';
1436
+                    $comClose = '*'.$this->rd;
1437 1437
                     $level    = 1;
1438 1438
                     $ptr      = $this->getPointer();
1439 1439
 
@@ -1443,33 +1443,33 @@  discard block
 block discarded – undo
1443 1443
 
1444 1444
                         if ($open !== false && $close !== false) {
1445 1445
                             if ($open < $close) {
1446
-                                $ptr = $open + strlen($comOpen);
1447
-                                ++ $level;
1446
+                                $ptr = $open+strlen($comOpen);
1447
+                                ++$level;
1448 1448
                             } else {
1449
-                                $ptr = $close + strlen($comClose);
1450
-                                -- $level;
1449
+                                $ptr = $close+strlen($comClose);
1450
+                                --$level;
1451 1451
                             }
1452 1452
                         } elseif ($open !== false) {
1453
-                            $ptr = $open + strlen($comOpen);
1454
-                            ++ $level;
1453
+                            $ptr = $open+strlen($comOpen);
1454
+                            ++$level;
1455 1455
                         } elseif ($close !== false) {
1456
-                            $ptr = $close + strlen($comClose);
1457
-                            -- $level;
1456
+                            $ptr = $close+strlen($comClose);
1457
+                            --$level;
1458 1458
                         } else {
1459 1459
                             $ptr = strlen($src);
1460 1460
                         }
1461 1461
                     }
1462
-                    $endpos = $ptr - strlen('*' . $this->rd);
1462
+                    $endpos = $ptr-strlen('*'.$this->rd);
1463 1463
                 } else {
1464
-                    $endpos = strpos($src, '*' . $this->rd, $startpos);
1464
+                    $endpos = strpos($src, '*'.$this->rd, $startpos);
1465 1465
                     if ($endpos == false) {
1466 1466
                         throw new CompilationException($this, 'Un-ended comment');
1467 1467
                     }
1468 1468
                 }
1469
-                $pointer += $endpos - $startpos + strlen('*' . $this->rd);
1470
-                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos + strlen('*' . $this->rd)), $m)) {
1469
+                $pointer += $endpos-$startpos+strlen('*'.$this->rd);
1470
+                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos+strlen('*'.$this->rd)), $m)) {
1471 1471
                     $pointer += strlen($m[0]);
1472
-                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer']) - ($this->getPointer() - $startpos - strlen($this->ld)));
1472
+                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer'])-($this->getPointer()-$startpos-strlen($this->ld)));
1473 1473
                 }
1474 1474
 
1475 1475
                 return false;
@@ -1486,20 +1486,20 @@  discard block
 block discarded – undo
1486 1486
         } elseif (($first === '"' || $first === "'") && !(is_array($parsingParams) && preg_match('#^([\'"])[a-z0-9_]+\1\s*=>?(?:\s+|[^=])#i', $substr))) {
1487 1487
             // string
1488 1488
             $out = $this->parseString($in, $from, $to, $parsingParams, $curBlock, $pointer);
1489
-        } elseif (preg_match('/^\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?(' . (is_array($parsingParams) || $curBlock != 'root' ? '' : '\s+[^(]|') . '\s*\(|\s*' . $this->rdr . '|\s*;)/i', $substr)) {
1489
+        } elseif (preg_match('/^\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?('.(is_array($parsingParams) || $curBlock != 'root' ? '' : '\s+[^(]|').'\s*\(|\s*'.$this->rdr.'|\s*;)/i', $substr)) {
1490 1490
             // func
1491 1491
             $out    = $this->parseFunction($in, $from, $to, $parsingParams, $curBlock, $pointer);
1492 1492
             $parsed = 'func';
1493 1493
         } elseif ($first === ';') {
1494 1494
             // instruction end
1495 1495
             if ($this->debug) {
1496
-                echo 'END OF INSTRUCTION' . "\n";
1496
+                echo 'END OF INSTRUCTION'."\n";
1497 1497
             }
1498 1498
             if ($pointer !== null) {
1499
-                ++ $pointer;
1499
+                ++$pointer;
1500 1500
             }
1501 1501
 
1502
-            return $this->parse($in, $from + 1, $to, false, 'root', $pointer);
1502
+            return $this->parse($in, $from+1, $to, false, 'root', $pointer);
1503 1503
         } elseif ($curBlock === 'root' && preg_match('#^/([a-z_][a-z0-9_]*)?#i', $substr, $match)) {
1504 1504
             // close block
1505 1505
             if (!empty($match[1]) && $match[1] == 'else') {
@@ -1516,13 +1516,13 @@  discard block
 block discarded – undo
1516 1516
                     $pointer -= strlen($match[0]);
1517 1517
                 }
1518 1518
                 if ($this->debug) {
1519
-                    echo 'TOP BLOCK CLOSED' . "\n";
1519
+                    echo 'TOP BLOCK CLOSED'."\n";
1520 1520
                 }
1521 1521
 
1522 1522
                 return $this->removeTopBlock();
1523 1523
             } else {
1524 1524
                 if ($this->debug) {
1525
-                    echo 'BLOCK OF TYPE ' . $match[1] . ' CLOSED' . "\n";
1525
+                    echo 'BLOCK OF TYPE '.$match[1].' CLOSED'."\n";
1526 1526
                 }
1527 1527
 
1528 1528
                 return $this->removeBlock($match[1]);
@@ -1530,19 +1530,19 @@  discard block
 block discarded – undo
1530 1530
         } elseif ($curBlock === 'root' && substr($substr, 0, strlen($this->rd)) === $this->rd) {
1531 1531
             // end template tag
1532 1532
             if ($this->debug) {
1533
-                echo 'TAG PARSING ENDED' . "\n";
1533
+                echo 'TAG PARSING ENDED'."\n";
1534 1534
             }
1535 1535
             $pointer += strlen($this->rd);
1536 1536
 
1537 1537
             return false;
1538
-        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*=' . ($curBlock === 'array' ? '>?' : '') . ')(?:\s+|[^=]).*#i', $substr, $match)) {
1538
+        } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*='.($curBlock === 'array' ? '>?' : '').')(?:\s+|[^=]).*#i', $substr, $match)) {
1539 1539
             // named parameter
1540 1540
             if ($this->debug) {
1541
-                echo 'NAMED PARAM FOUND' . "\n";
1541
+                echo 'NAMED PARAM FOUND'."\n";
1542 1542
             }
1543 1543
             $len = strlen($match[1]);
1544
-            while (substr($in, $from + $len, 1) === ' ') {
1545
-                ++ $len;
1544
+            while (substr($in, $from+$len, 1) === ' ') {
1545
+                ++$len;
1546 1546
             }
1547 1547
             if ($pointer !== null) {
1548 1548
                 $pointer += $len;
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 
1551 1551
             $output = array(
1552 1552
                 trim($match[1], " \t\r\n=>'\""),
1553
-                $this->parse($in, $from + $len, $to, false, 'namedparam', $pointer)
1553
+                $this->parse($in, $from+$len, $to, false, 'namedparam', $pointer)
1554 1554
             );
1555 1555
 
1556 1556
             $parsingParams[] = $output;
@@ -1571,31 +1571,31 @@  discard block
 block discarded – undo
1571 1571
             $out = $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1572 1572
         } else {
1573 1573
             // parse error
1574
-            throw new CompilationException($this, 'Parse error in "' . substr($in, $from, $to - $from) . '"');
1574
+            throw new CompilationException($this, 'Parse error in "'.substr($in, $from, $to-$from).'"');
1575 1575
         }
1576 1576
 
1577 1577
         if (empty($out)) {
1578 1578
             return '';
1579 1579
         }
1580 1580
 
1581
-        $substr = substr($in, $pointer, $to - $pointer);
1581
+        $substr = substr($in, $pointer, $to-$pointer);
1582 1582
 
1583 1583
         // var parsed, check if any var-extension applies
1584 1584
         if ($parsed === 'var') {
1585 1585
             if (preg_match('#^\s*([/%+*-])\s*([a-z0-9]|\$)#i', $substr, $match)) {
1586 1586
                 if ($this->debug) {
1587
-                    echo 'PARSING POST-VAR EXPRESSION ' . $substr . "\n";
1587
+                    echo 'PARSING POST-VAR EXPRESSION '.$substr."\n";
1588 1588
                 }
1589 1589
                 // parse expressions
1590
-                $pointer += strlen($match[0]) - 1;
1590
+                $pointer += strlen($match[0])-1;
1591 1591
                 if (is_array($parsingParams)) {
1592 1592
                     if ($match[2] == '$') {
1593 1593
                         $expr = $this->parseVar($in, $pointer, $to, array(), $curBlock, $pointer);
1594 1594
                     } else {
1595 1595
                         $expr = $this->parse($in, $pointer, $to, array(), 'expression', $pointer);
1596 1596
                     }
1597
-                    $out[count($out) - 1][0] .= $match[1] . $expr[0][0];
1598
-                    $out[count($out) - 1][1] .= $match[1] . $expr[0][1];
1597
+                    $out[count($out)-1][0] .= $match[1].$expr[0][0];
1598
+                    $out[count($out)-1][1] .= $match[1].$expr[0][1];
1599 1599
                 } else {
1600 1600
                     if ($match[2] == '$') {
1601 1601
                         $expr = $this->parseVar($in, $pointer, $to, false, $curBlock, $pointer);
@@ -1603,26 +1603,26 @@  discard block
 block discarded – undo
1603 1603
                         $expr = $this->parse($in, $pointer, $to, false, 'expression', $pointer);
1604 1604
                     }
1605 1605
                     if (is_array($out) && is_array($expr)) {
1606
-                        $out[0] .= $match[1] . $expr[0];
1607
-                        $out[1] .= $match[1] . $expr[1];
1606
+                        $out[0] .= $match[1].$expr[0];
1607
+                        $out[1] .= $match[1].$expr[1];
1608 1608
                     } elseif (is_array($out)) {
1609
-                        $out[0] .= $match[1] . $expr;
1610
-                        $out[1] .= $match[1] . $expr;
1609
+                        $out[0] .= $match[1].$expr;
1610
+                        $out[1] .= $match[1].$expr;
1611 1611
                     } elseif (is_array($expr)) {
1612
-                        $out .= $match[1] . $expr[0];
1612
+                        $out .= $match[1].$expr[0];
1613 1613
                     } else {
1614
-                        $out .= $match[1] . $expr;
1614
+                        $out .= $match[1].$expr;
1615 1615
                     }
1616 1616
                 }
1617 1617
             } elseif ($curBlock === 'root' && preg_match('#^(\s*(?:[+/*%-.]=|=|\+\+|--)\s*)(.*)#s', $substr, $match)) {
1618 1618
                 if ($this->debug) {
1619
-                    echo 'PARSING POST-VAR ASSIGNMENT ' . $substr . "\n";
1619
+                    echo 'PARSING POST-VAR ASSIGNMENT '.$substr."\n";
1620 1620
                 }
1621 1621
                 // parse assignment
1622 1622
                 $value    = $match[2];
1623 1623
                 $operator = trim($match[1]);
1624 1624
                 if (substr($value, 0, 1) == '=') {
1625
-                    throw new CompilationException($this, 'Unexpected "=" in <em>' . $substr . '</em>');
1625
+                    throw new CompilationException($this, 'Unexpected "=" in <em>'.$substr.'</em>');
1626 1626
                 }
1627 1627
 
1628 1628
                 if ($pointer !== null) {
@@ -1643,7 +1643,7 @@  discard block
 block discarded – undo
1643 1643
                         throw new CompilationException($this, 'Assignments require the "if" plugin to be accessible');
1644 1644
                     }
1645 1645
 
1646
-                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf', 'init'), 1);
1646
+                    $parts  = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS.'PluginIf', 'init'), 1);
1647 1647
                     $tokens = $this->getParamTokens($parts);
1648 1648
                     $parts  = $this->getCompiledParams($parts);
1649 1649
 
@@ -1657,14 +1657,14 @@  discard block
 block discarded – undo
1657 1657
                 if ($this->autoEscape) {
1658 1658
                     $out = preg_replace('#\(is_string\(\$tmp=(.+?)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $out);
1659 1659
                 }
1660
-                $out = self::PHP_OPEN . $echo . $out . $operator . implode(' ', $value) . self::PHP_CLOSE;
1660
+                $out = self::PHP_OPEN.$echo.$out.$operator.implode(' ', $value).self::PHP_CLOSE;
1661 1661
             } elseif ($curBlock === 'array' && is_array($parsingParams) && preg_match('#^(\s*=>?\s*)#', $substr, $match)) {
1662 1662
                 // parse namedparam with var as name (only for array)
1663 1663
                 if ($this->debug) {
1664
-                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND' . "\n";
1664
+                    echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND'."\n";
1665 1665
                 }
1666 1666
                 $len = strlen($match[1]);
1667
-                $var = $out[count($out) - 1];
1667
+                $var = $out[count($out)-1];
1668 1668
                 $pointer += $len;
1669 1669
 
1670 1670
                 $output = array($var[0], $this->parse($substr, $len, null, false, 'namedparam', $pointer));
@@ -1679,16 +1679,16 @@  discard block
 block discarded – undo
1679 1679
             // parse modifier on funcs or vars
1680 1680
             $srcPointer = $pointer;
1681 1681
             if (is_array($parsingParams)) {
1682
-                $tmp                     = $this->replaceModifiers(
1682
+                $tmp = $this->replaceModifiers(
1683 1683
                     array(
1684 1684
                     null,
1685 1685
                     null,
1686
-                    $out[count($out) - 1][0],
1686
+                    $out[count($out)-1][0],
1687 1687
                     $match[0]
1688 1688
                     ), $curBlock, $pointer
1689 1689
                 );
1690
-                $out[count($out) - 1][0] = $tmp;
1691
-                $out[count($out) - 1][1] .= substr($substr, $srcPointer, $srcPointer - $pointer);
1690
+                $out[count($out)-1][0] = $tmp;
1691
+                $out[count($out)-1][1] .= substr($substr, $srcPointer, $srcPointer-$pointer);
1692 1692
             } else {
1693 1693
                 $out = $this->replaceModifiers(array(null, null, $out, $match[0]), $curBlock, $pointer);
1694 1694
             }
@@ -1700,10 +1700,10 @@  discard block
 block discarded – undo
1700 1700
             $ptr = 0;
1701 1701
 
1702 1702
             if (is_array($parsingParams)) {
1703
-                $output = $this->parseMethodCall($out[count($out) - 1][1], $match[0], $curBlock, $ptr);
1703
+                $output = $this->parseMethodCall($out[count($out)-1][1], $match[0], $curBlock, $ptr);
1704 1704
 
1705
-                $out[count($out) - 1][0] = $output;
1706
-                $out[count($out) - 1][1] .= substr($match[0], 0, $ptr);
1705
+                $out[count($out)-1][0] = $output;
1706
+                $out[count($out)-1][1] .= substr($match[0], 0, $ptr);
1707 1707
             } else {
1708 1708
                 $out = $this->parseMethodCall($out, $match[0], $curBlock, $ptr);
1709 1709
             }
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
         }
1713 1713
 
1714 1714
         if ($curBlock === 'root' && substr($out, 0, strlen(self::PHP_OPEN)) !== self::PHP_OPEN) {
1715
-            return self::PHP_OPEN . 'echo ' . $out . ';' . self::PHP_CLOSE;
1715
+            return self::PHP_OPEN.'echo '.$out.';'.self::PHP_CLOSE;
1716 1716
         }
1717 1717
 
1718 1718
         return $out;
@@ -1738,11 +1738,11 @@  discard block
 block discarded – undo
1738 1738
     protected function parseFunction($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1739 1739
     {
1740 1740
         $output = '';
1741
-        $cmdstr = substr($in, $from, $to - $from);
1742
-        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*' . $this->rdr . '|\s*;)?/i', $cmdstr, $match);
1741
+        $cmdstr = substr($in, $from, $to-$from);
1742
+        preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*'.$this->rdr.'|\s*;)?/i', $cmdstr, $match);
1743 1743
 
1744 1744
         if (empty($match[1])) {
1745
-            throw new CompilationException($this, 'Parse error, invalid function name : ' . substr($cmdstr, 0, 15));
1745
+            throw new CompilationException($this, 'Parse error, invalid function name : '.substr($cmdstr, 0, 15));
1746 1746
         }
1747 1747
 
1748 1748
         $func = $match[1];
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
         }
1753 1753
 
1754 1754
         if ($this->debug) {
1755
-            echo 'FUNC FOUND (' . $func . ')' . "\n";
1755
+            echo 'FUNC FOUND ('.$func.')'."\n";
1756 1756
         }
1757 1757
 
1758 1758
         $paramsep = '';
@@ -1764,11 +1764,11 @@  discard block
 block discarded – undo
1764 1764
             $paramspos = $match[1][0][1];
1765 1765
             $paramsep  = substr($match[1][0][0], - 1) === '(' ? ')' : '';
1766 1766
             if ($paramsep === ')') {
1767
-                $paramspos += strlen($match[1][0][0]) - 1;
1767
+                $paramspos += strlen($match[1][0][0])-1;
1768 1768
                 if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') {
1769 1769
                     $paramsep = '';
1770 1770
                     if (strlen($match[1][0][0]) > 1) {
1771
-                        -- $paramspos;
1771
+                        --$paramspos;
1772 1772
                     }
1773 1773
                 }
1774 1774
             }
@@ -1793,8 +1793,8 @@