Completed
Push — master ( 7329e0...83359d )
by Ben
30s queued 16s
created
classes/PHPTAL.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -975,10 +975,10 @@  discard block
 block discarded – undo
975 975
      */
976 976
     public function getFunctionName()
977 977
     {
978
-       // function name is used as base for caching, so it must be unique for
979
-       // every combination of settings that changes code in compiled template
978
+        // function name is used as base for caching, so it must be unique for
979
+        // every combination of settings that changes code in compiled template
980 980
 
981
-       if (!$this->_functionName) {
981
+        if (!$this->_functionName) {
982 982
 
983 983
             // just to make tempalte name recognizable
984 984
             $basename = preg_replace('/\.[a-z]{3,5}$/', '', basename($this->_source->getRealPath() ?? ''));
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
             $hash = strtr(rtrim(base64_encode($hash),"="),"+/=","_A_");
999 999
 
1000 1000
             $this->_functionName = $this->getFunctionNamePrefix($this->_source->getLastModifiedTime()) .
1001
-                                   $basename . '__' . $hash;
1001
+                                    $basename . '__' . $hash;
1002 1002
         }
1003 1003
         return $this->_functionName;
1004 1004
     }
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,10 +76,11 @@
 block discarded – undo
76 76
 
77 77
     protected function doEchoAttribute(PHPTAL_Php_CodeWriter $codewriter, $code)
78 78
     {
79
-        if ($this->_echoType === self::ECHO_TEXT)
80
-            $codewriter->doEcho($code);
81
-        else
82
-            $codewriter->doEchoRaw($code);
79
+        if ($this->_echoType === self::ECHO_TEXT) {
80
+                    $codewriter->doEcho($code);
81
+        } else {
82
+                    $codewriter->doEchoRaw($code);
83
+        }
83 84
     }
84 85
 
85 86
     /**
Please login to merge, or discard this patch.
classes/PHPTAL/Php/TalesChainExecutor.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,10 +82,12 @@
 block discarded – undo
82 82
                 $this->reader->talesChainPart($this, $exp, $lastkey === $key);
83 83
             }
84 84
 
85
-            if ($this->state == self::CHAIN_BREAK)
86
-                break;
87
-            if ($this->state == self::CHAIN_CONT)
88
-                continue;
85
+            if ($this->state == self::CHAIN_BREAK) {
86
+                            break;
87
+            }
88
+            if ($this->state == self::CHAIN_CONT) {
89
+                            continue;
90
+            }
89 91
         }
90 92
 
91 93
         $this->codewriter->doEnd('if');
Please login to merge, or discard this patch.
classes/PHPTAL/Tokenizer.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@
 block discarded – undo
42 42
 
43 43
     function skipSpace()
44 44
     {
45
-        while ($this->current_token === 'SPACE') $this->nextToken();
45
+        while ($this->current_token === 'SPACE') {
46
+            $this->nextToken();
47
+        }
46 48
     }
47 49
 
48 50
     function nextToken()
Please login to merge, or discard this patch.
classes/PHPTAL/Dom/SaxXmlParser.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
 
61 61
 
62 62
     static $state_names = array(
63
-      self::ST_ROOT => 'root node',
64
-      self::ST_TEXT => 'text',
65
-      self::ST_LT   => 'start of tag',
66
-      self::ST_TAG_NAME => 'tag name',
67
-      self::ST_TAG_CLOSE => 'closing tag',
68
-      self::ST_TAG_SINGLE => 'self-closing tag',
69
-      self::ST_TAG_ATTRIBUTES => 'tag',
70
-      self::ST_TAG_BETWEEN_ATTRIBUTE => 'tag attributes',
71
-      self::ST_CDATA => 'CDATA',
72
-      self::ST_COMMENT => 'comment',
73
-      self::ST_DOCTYPE => 'doctype',
74
-      self::ST_XMLDEC => 'XML declaration',
75
-      self::ST_PREPROC => 'preprocessor directive',
76
-      self::ST_ATTR_KEY => 'attribute name',
77
-      self::ST_ATTR_EQ => 'attribute value',
78
-      self::ST_ATTR_QUOTE => 'quoted attribute value',
79
-      self::ST_ATTR_VALUE => 'unquoted attribute value',
63
+        self::ST_ROOT => 'root node',
64
+        self::ST_TEXT => 'text',
65
+        self::ST_LT   => 'start of tag',
66
+        self::ST_TAG_NAME => 'tag name',
67
+        self::ST_TAG_CLOSE => 'closing tag',
68
+        self::ST_TAG_SINGLE => 'self-closing tag',
69
+        self::ST_TAG_ATTRIBUTES => 'tag',
70
+        self::ST_TAG_BETWEEN_ATTRIBUTE => 'tag attributes',
71
+        self::ST_CDATA => 'CDATA',
72
+        self::ST_COMMENT => 'comment',
73
+        self::ST_DOCTYPE => 'doctype',
74
+        self::ST_XMLDEC => 'XML declaration',
75
+        self::ST_PREPROC => 'preprocessor directive',
76
+        self::ST_ATTR_KEY => 'attribute name',
77
+        self::ST_ATTR_EQ => 'attribute value',
78
+        self::ST_ATTR_QUOTE => 'quoted attribute value',
79
+        self::ST_ATTR_VALUE => 'unquoted attribute value',
80 80
     );
81 81
 
82 82
     private $input_encoding;
@@ -381,15 +381,15 @@  discard block
 block discarded – undo
381 381
 
382 382
             // http://www.w3.org/International/questions/qa-forms-utf-8
383 383
             $match = '[\x09\x0A\x0D\x20-\x7F]'        // ASCII
384
-               . '|[\xC2-\xDF][\x80-\xBF]'            // non-overlong 2-byte
385
-               . '|\xE0[\xA0-\xBF][\x80-\xBF]'        // excluding overlongs
386
-               . '|[\xE1-\xEC\xEE\xEE][\x80-\xBF]{2}' // straight 3-byte (exclude FFFE and FFFF)
387
-               . '|\xEF[\x80-\xBE][\x80-\xBF]'        // straight 3-byte
388
-               . '|\xEF\xBF[\x80-\xBD]'               // straight 3-byte
389
-               . '|\xED[\x80-\x9F][\x80-\xBF]'        // excluding surrogates
390
-               . '|\xF0[\x90-\xBF][\x80-\xBF]{2}'     // planes 1-3
391
-               . '|[\xF1-\xF3][\x80-\xBF]{3}'         // planes 4-15
392
-               . '|\xF4[\x80-\x8F][\x80-\xBF]{2}';    // plane 16
384
+                . '|[\xC2-\xDF][\x80-\xBF]'            // non-overlong 2-byte
385
+                . '|\xE0[\xA0-\xBF][\x80-\xBF]'        // excluding overlongs
386
+                . '|[\xE1-\xEC\xEE\xEE][\x80-\xBF]{2}' // straight 3-byte (exclude FFFE and FFFF)
387
+                . '|\xEF[\x80-\xBE][\x80-\xBF]'        // straight 3-byte
388
+                . '|\xEF\xBF[\x80-\xBD]'               // straight 3-byte
389
+                . '|\xED[\x80-\x9F][\x80-\xBF]'        // excluding surrogates
390
+                . '|\xF0[\x90-\xBF][\x80-\xBF]{2}'     // planes 1-3
391
+                . '|[\xF1-\xF3][\x80-\xBF]{3}'         // planes 4-15
392
+                . '|\xF4[\x80-\x8F][\x80-\xBF]{2}';    // plane 16
393 393
 
394 394
             if (!preg_match('/^(?:(?>'.$match.'))+$/s',$str)) {
395 395
                 $res = preg_split('/((?>'.$match.')+)/s',$str,0,PREG_SPLIT_DELIM_CAPTURE);
Please login to merge, or discard this patch.
Braces   +27 added lines, -11 removed lines patch added patch discarded remove patch
@@ -124,7 +124,9 @@  discard block
 block discarded – undo
124 124
             for (; $i<$len; $i++) {
125 125
                 $c = $src[$i]; // Change to substr($src, $i, 1); if you want to use mb_string.func_overload
126 126
 
127
-                if ($c === "\n") $builder->setSource($this->_file, ++$this->_line);
127
+                if ($c === "\n") {
128
+                    $builder->setSource($this->_file, ++$this->_line);
129
+                }
128 130
 
129 131
                 switch ($state) {
130 132
                     case self::ST_ROOT:
@@ -174,7 +176,9 @@  discard block
 block discarded – undo
174 176
                     case self::ST_TAG_NAME:
175 177
                         if (self::isWhiteChar($c) || $c === '/' || $c === '>') {
176 178
                             $tagname = substr($src, $mark, $i-$mark);
177
-                            if (!$this->isValidQName($tagname)) $this->raiseError("Invalid tag name '$tagname'");
179
+                            if (!$this->isValidQName($tagname)) {
180
+                                $this->raiseError("Invalid tag name '$tagname'");
181
+                            }
178 182
 
179 183
                             if ($c === '/') {
180 184
                                 $state = self::ST_TAG_SINGLE;
@@ -220,7 +224,9 @@  discard block
 block discarded – undo
220 224
                         } elseif ($state === self::ST_TAG_ATTRIBUTES && $this->isValidQName($c)) {
221 225
                             $mark = $i; // mark attribute key start
222 226
                             $state = self::ST_ATTR_KEY;
223
-                        } else $this->raiseError("Unexpected character '$c' between attributes of < $tagname >");
227
+                        } else {
228
+                            $this->raiseError("Unexpected character '$c' between attributes of < $tagname >");
229
+                        }
224 230
                         break;
225 231
 
226 232
                     case self::ST_COMMENT:
@@ -287,8 +293,11 @@  discard block
 block discarded – undo
287 293
                                 $this->raiseError("Attribute $attribute in < $tagname > is defined more than once");
288 294
                             }
289 295
 
290
-                            if ($c === '=') $state = self::ST_ATTR_VALUE;
291
-                            else /* white char */ $state = self::ST_ATTR_EQ;
296
+                            if ($c === '=') {
297
+                                $state = self::ST_ATTR_VALUE;
298
+                            } else {
299
+                                /* white char */ $state = self::ST_ATTR_EQ;
300
+                            }
292 301
                         } elseif ($c === '/' || $c==='>') {
293 302
                             $attribute = substr($src, $mark, $i-$mark);
294 303
                             if (!$this->isValidQName($attribute)) {
@@ -330,11 +339,15 @@  discard block
 block discarded – undo
330 339
                 }
331 340
             }
332 341
 
333
-            if ($state === self::ST_TEXT) // allows text past root node, which is in violation of XML spec
342
+            if ($state === self::ST_TEXT) {
343
+                // allows text past root node, which is in violation of XML spec
334 344
             {
335 345
                 if ($i > $mark) {
336 346
                     $text = substr($src, $mark, $i-$mark);
337
-                    if (!ctype_space($text)) $this->raiseError("Characters found after end of the root element (wrap document in < tal:block > to avoid this error)");
347
+            }
348
+                    if (!ctype_space($text)) {
349
+                        $this->raiseError("Characters found after end of the root element (wrap document in < tal:block > to avoid this error)");
350
+                    }
338 351
                 }
339 352
             } else {
340 353
                 if ($state === self::ST_ROOT) {
@@ -346,8 +359,7 @@  discard block
 block discarded – undo
346 359
             }
347 360
 
348 361
             $builder->onDocumentEnd();
349
-        }
350
-        catch(PHPTAL_TemplateException $e)
362
+        } catch(PHPTAL_TemplateException $e)
351 363
         {
352 364
             $e->hintSrcPosition($this->_file, $this->_line);
353 365
             throw $e;
@@ -363,7 +375,9 @@  discard block
 block discarded – undo
363 375
 
364 376
     private function checkEncoding($str)
365 377
     {
366
-        if ($str === '') return '';
378
+        if ($str === '') {
379
+            return '';
380
+        }
367 381
 
368 382
         if ($this->input_encoding === 'UTF-8') {
369 383
 
@@ -445,7 +459,9 @@  discard block
 block discarded – undo
445 459
         */
446 460
         $str = preg_replace_callback('/<\?(php|=)(.*?)\?>/', static function ($m) {
447 461
             list(, $type, $code) = $m;
448
-            if ($type === '=') $code = 'echo '.$code;
462
+            if ($type === '=') {
463
+                $code = 'echo '.$code;
464
+            }
449 465
             return '${structure phptal-internal-php-block:'.rawurlencode($code).'}';
450 466
         }, $str);
451 467
 
Please login to merge, or discard this patch.