Completed
Branch 1.11.x (83359d)
by Ben
18s
created
classes/PHPTAL/Php/Transformer.php 1 patch
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,8 +63,11 @@  discard block
 block discarded – undo
63 63
 
64 64
 
65 65
         for ($i = 0; $i <= $len; $i++) {
66
-            if ($i == $len) $c = "\0";
67
-            else $c = $str[$i];
66
+            if ($i == $len) {
67
+                $c = "\0";
68
+            } else {
69
+                $c = $str[$i];
70
+            }
68 71
 
69 72
             switch ($state) {
70 73
 
@@ -85,8 +88,7 @@  discard block
 block discarded – undo
85 88
                         $state = self::ST_EVAL;
86 89
                         $mark = $i+1;
87 90
                         $result .= $prefix.'{';
88
-                    }
89
-                    elseif (self::isDigit($c))
91
+                    } elseif (self::isDigit($c))
90 92
                     {
91 93
                         $state = self::ST_NUM;
92 94
                         $mark = $i;
@@ -126,8 +128,7 @@  discard block
 block discarded – undo
126 128
                     elseif ($c === '@') {
127 129
                         $state = self::ST_DEFINE;
128 130
                         $mark = $i+1;
129
-                    }
130
-                    elseif (ctype_space($c)) {
131
+                    } elseif (ctype_space($c)) {
131 132
                         $state = self::ST_WHITE;
132 133
                         $result .= $c;
133 134
                     }
@@ -377,7 +378,9 @@  discard block
 block discarded – undo
377 378
         $result = trim($result);
378 379
 
379 380
         // CodeWriter doesn't like expressions that look like blocks
380
-        if ($result[strlen($result)-1] === '}') return '('.$result.')';
381
+        if ($result[strlen($result)-1] === '}') {
382
+            return '('.$result.')';
383
+        }
381 384
 
382 385
         return $result;
383 386
     }
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/TAL/Attributes.php 1 patch
Braces   +13 added lines, -9 removed lines patch added patch discarded remove patch
@@ -115,10 +115,11 @@  discard block
 block discarded – undo
115 115
 
116 116
         $codewriter->doIf("null !== ($attkey = ($code))");
117 117
 
118
-        if ($this->_echoType !== PHPTAL_Php_Attribute::ECHO_STRUCTURE)
119
-            $codewriter->doSetVar($attkey, $codewriter->str(" $qname=\"").".".$codewriter->escapeCode($attkey).".'\"'");
120
-        else
121
-            $codewriter->doSetVar($attkey, $codewriter->str(" $qname=\"").".".$codewriter->stringifyCode($attkey).".'\"'");
118
+        if ($this->_echoType !== PHPTAL_Php_Attribute::ECHO_STRUCTURE) {
119
+                    $codewriter->doSetVar($attkey, $codewriter->str(" $qname=\"").".".$codewriter->escapeCode($attkey).".'\"'");
120
+        } else {
121
+                    $codewriter->doSetVar($attkey, $codewriter->str(" $qname=\"").".".$codewriter->stringifyCode($attkey).".'\"'");
122
+        }
122 123
 
123 124
         $codewriter->doElse();
124 125
         $codewriter->doSetVar($attkey, "''");
@@ -166,7 +167,9 @@  discard block
 block discarded – undo
166 167
 
167 168
     public function after(PHPTAL_Php_CodeWriter $codewriter)
168 169
     {
169
-        foreach ($this->vars_to_recycle as $var) $codewriter->recycleTempVariable($var);
170
+        foreach ($this->vars_to_recycle as $var) {
171
+            $codewriter->recycleTempVariable($var);
172
+        }
170 173
     }
171 174
 
172 175
     public function talesChainNothingKeyword(PHPTAL_Php_TalesChainExecutor $executor)
@@ -202,10 +205,11 @@  discard block
 block discarded – undo
202 205
         }
203 206
         $executor->doIf($condition);
204 207
 
205
-        if ($this->_echoType == PHPTAL_Php_Attribute::ECHO_STRUCTURE)
206
-            $value = $codewriter->stringifyCode($this->_attkey);
207
-        else
208
-            $value = $codewriter->escapeCode($this->_attkey);
208
+        if ($this->_echoType == PHPTAL_Php_Attribute::ECHO_STRUCTURE) {
209
+                    $value = $codewriter->stringifyCode($this->_attkey);
210
+        } else {
211
+                    $value = $codewriter->escapeCode($this->_attkey);
212
+        }
209 213
 
210 214
         $codewriter->doSetVar($this->_attkey, $codewriter->str(" {$this->_attribute}=\"").".$value.'\"'");
211 215
     }
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/TAL/OmitTag.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@
 block discarded – undo
64 64
 
65 65
     public function after(PHPTAL_Php_CodeWriter $codewriter)
66 66
     {
67
-        if ($this->varname) $codewriter->recycleTempVariable($this->varname);
67
+        if ($this->varname) {
68
+            $codewriter->recycleTempVariable($this->varname);
69
+        }
68 70
     }
69 71
 }
70 72
 
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/TAL/Define.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@  discard block
 block discarded – undo
62 62
             $this->_defineScope = $defineScope;
63 63
 
64 64
             // <span tal:define="global foo" /> should be invisible, but <img tal:define="bar baz" /> not
65
-            if ($defineScope != 'global') $definesAnyNonGlobalVars = true;
65
+            if ($defineScope != 'global') {
66
+                $definesAnyNonGlobalVars = true;
67
+            }
66 68
 
67 69
             if ($this->_defineScope != 'global' && !$this->_pushedContext) {
68 70
                 $codewriter->pushContext();
@@ -94,7 +96,9 @@  discard block
 block discarded – undo
94 96
 
95 97
     public function after(PHPTAL_Php_CodeWriter $codewriter)
96 98
     {
97
-        if ($this->tmp_content_var) $codewriter->recycleTempVariable($this->tmp_content_var);
99
+        if ($this->tmp_content_var) {
100
+            $codewriter->recycleTempVariable($this->tmp_content_var);
101
+        }
98 102
         if ($this->_pushedContext) {
99 103
             $codewriter->popContext();
100 104
         }
@@ -109,7 +113,9 @@  discard block
 block discarded – undo
109 113
 
110 114
     public function talesChainNothingKeyword(PHPTAL_Php_TalesChainExecutor $executor)
111 115
     {
112
-        if (!$this->_chainPartGenerated) throw new PHPTAL_TemplateException("Invalid expression in tal:define", $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
116
+        if (!$this->_chainPartGenerated) {
117
+            throw new PHPTAL_TemplateException("Invalid expression in tal:define", $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
118
+        }
113 119
 
114 120
         $executor->doElse();
115 121
         $this->doDefineVarWith($executor->getCodeWriter(), 'null');
@@ -118,7 +124,9 @@  discard block
 block discarded – undo
118 124
 
119 125
     public function talesChainDefaultKeyword(PHPTAL_Php_TalesChainExecutor $executor)
120 126
     {
121
-        if (!$this->_chainPartGenerated) throw new PHPTAL_TemplateException("Invalid expression in tal:define", $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
127
+        if (!$this->_chainPartGenerated) {
128
+            throw new PHPTAL_TemplateException("Invalid expression in tal:define", $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
129
+        }
122 130
 
123 131
         $executor->doElse();
124 132
         $this->bufferizeContent($executor->getCodeWriter());
@@ -165,7 +173,9 @@  discard block
 block discarded – undo
165 173
 
166 174
         // extract varname and expression from remaining of expression
167 175
         list($defineVar, $exp) = $this->parseSetExpression($exp);
168
-        if ($exp !== null) $exp = trim($exp);
176
+        if ($exp !== null) {
177
+            $exp = trim($exp);
178
+        }
169 179
         return array($defineScope, $defineVar, $exp);
170 180
     }
171 181
 
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/I18N/Attributes.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,8 +73,10 @@
 block discarded – undo
73 73
                 $code = $this->_getTranslationCode($codewriter, $key);
74 74
             } else {
75 75
                 $attr = $this->phpelement->getAttributeNode($qname);
76
-                if (!$attr) throw new PHPTAL_TemplateException("Unable to translate attribute $qname, because there is no translation key specified",
76
+                if (!$attr) {
77
+                    throw new PHPTAL_TemplateException("Unable to translate attribute $qname, because there is no translation key specified",
77 78
                                         $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
79
+                }
78 80
 
79 81
                 if ($attr->getReplacedState() === PHPTAL_Dom_Attr::NOT_REPLACED) {
80 82
                     $code = $this->_getTranslationCode($codewriter, $attr->getValue());
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/I18N/Translate.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
             $code = $codewriter->str($key);
53 53
         } else {
54 54
             $code = $codewriter->evaluateExpression($this->expression);
55
-            if (is_array($code))
56
-                return $this->generateChainedContent($codewriter, $code);
55
+            if (is_array($code)) {
56
+                            return $this->generateChainedContent($codewriter, $code);
57
+            }
57 58
 
58 59
             $code = $codewriter->evaluateExpression($this->expression);
59 60
         }
@@ -100,7 +101,9 @@  discard block
 block discarded – undo
100 101
                     if ($preserve_tags) {
101 102
                         $result .= '<'.$child->getQualifiedName();
102 103
                         foreach ($child->getAttributeNodes() as $attr) {
103
-                            if ($attr->getReplacedState() === PHPTAL_Dom_Attr::HIDDEN) continue;
104
+                            if ($attr->getReplacedState() === PHPTAL_Dom_Attr::HIDDEN) {
105
+                                continue;
106
+                            }
104 107
 
105 108
                             $result .= ' '.$attr->getQualifiedName().'="'.$attr->getValueEscaped().'"';
106 109
                         }
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/METAL/UseMacro.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,9 +56,10 @@
 block discarded – undo
56 56
 	// [should perhaps be a TemplateException? but I don't know how to set that up...]
57 57
 	if ($defineAttr = $this->phpelement->getAttributeNodeNS(
58 58
 		'http://xml.zope.org/namespaces/metal', 'define-macro')) {
59
-		if ($defineAttr->getValue() == $macroname) 
60
-            		throw new PHPTAL_TemplateException("Cannot simultaneously define and use macro '$macroname'",
61
-                		$this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());			
59
+		if ($defineAttr->getValue() == $macroname) {
60
+		            		throw new PHPTAL_TemplateException("Cannot simultaneously define and use macro '$macroname'",
61
+                		$this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
62
+		}
62 63
 	}
63 64
 
64 65
         // local macro (no filename specified) and non dynamic macro name
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/PHPTAL/Cache.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,10 @@  discard block
 block discarded – undo
50 50
         if (!is_numeric($cache_len)) {
51 51
             $cache_len = $codewriter->evaluateExpression($cache_len);
52 52
 
53
-            if (is_array($cache_len)) throw new PHPTAL_ParserException("Chained expressions in cache length are not supported",
53
+            if (is_array($cache_len)) {
54
+                throw new PHPTAL_ParserException("Chained expressions in cache length are not supported",
54 55
                                         $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
56
+            }
55 57
         }
56 58
         switch ($matches[2]) {
57 59
             case 'd': $cache_len .= '*24'; /* no break */
@@ -69,8 +71,10 @@  discard block
 block discarded – undo
69 71
         } elseif ($cache_per_expression) {
70 72
              $code = $codewriter->evaluateExpression($cache_per_expression);
71 73
 
72
-             if (is_array($code)) throw new PHPTAL_ParserException("Chained expressions in per-cache directive are not supported",
74
+             if (is_array($code)) {
75
+                 throw new PHPTAL_ParserException("Chained expressions in per-cache directive are not supported",
73 76
                                                 $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
77
+             }
74 78
 
75 79
              $cache_tag = '('.$code.')."@".' . $cache_tag;
76 80
         }
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/PHPTAL/Tales.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@
 block discarded – undo
24 24
         $mode = trim($this->expression);
25 25
         $mode = strtolower($mode);
26 26
 
27
-        if ($mode == '' || $mode == 'default')
28
-            $mode = 'tales';
27
+        if ($mode == '' || $mode == 'default') {
28
+                    $mode = 'tales';
29
+        }
29 30
 
30 31
         if ($mode != 'php' && $mode != 'tales') {
31 32
             throw new PHPTAL_TemplateException("Unsupported TALES mode '$mode'",
Please login to merge, or discard this patch.