Completed
Branch 1.3.x (b833d8)
by Ben
05:10
created
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
     protected function parseSetExpression($exp)
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/TAL/Repeat.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
         $code = $codewriter->evaluateExpression($expression);
81 81
 
82 82
         // instantiate controller using expression
83
-        $codewriter->doSetVar( $this->var.'->'.$varName, 'new PHPTAL_RepeatController('.$code.')'."\n" );
83
+        $codewriter->doSetVar($this->var.'->'.$varName, 'new PHPTAL_RepeatController('.$code.')'."\n");
84 84
 
85 85
         $codewriter->pushContext();
86 86
 
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 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * Prevents generation of invalid PHP code when given invalid TALES
48 48
      */
49
-    private $_chainPartGenerated=false;
49
+    private $_chainPartGenerated = false;
50 50
 
51 51
     public function before(PHPTAL_Php_CodeWriter $codewriter)
52 52
     {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $code = $codewriter->evaluateExpression($expression);
80 80
             if (is_array($code)) {
81 81
                 $this->chainedDefine($codewriter, $code);
82
-            } elseif ( $code == PHPTAL_Php_TalesInternal::NOTHING_KEYWORD) {
82
+            } elseif ($code == PHPTAL_Php_TalesInternal::NOTHING_KEYWORD) {
83 83
                 $this->doDefineVarWith($codewriter, 'null');
84 84
             } else {
85 85
                 $this->doDefineVarWith($codewriter, $code);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
     public function talesChainPart(PHPTAL_Php_TalesChainExecutor $executor, $exp, $islast)
129 129
     {
130
-        $this->_chainPartGenerated=true;
130
+        $this->_chainPartGenerated = true;
131 131
 
132 132
         if ($this->_defineScope == 'global') {
133 133
             $var = '$tpl->getGlobalContext()->'.$this->_defineVar;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     {
174 174
         if (!$this->_buffered) {
175 175
             $this->tmp_content_var = $codewriter->createTempVariable();
176
-            $codewriter->pushCode( 'ob_start()' );
176
+            $codewriter->pushCode('ob_start()');
177 177
             $this->phpelement->generateContent($codewriter);
178 178
             $codewriter->doSetVar($this->tmp_content_var, 'ob_get_clean()');
179 179
             $this->_buffered = true;
Please login to merge, or discard this 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/Target.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
  */
38 38
 class PHPTAL_Php_Attribute_I18N_Target extends PHPTAL_Php_Attribute
39 39
 {
40
-    public function before(PHPTAL_Php_CodeWriter $codewriter){}
41
-    public function after(PHPTAL_Php_CodeWriter $codewriter){}
40
+    public function before(PHPTAL_Php_CodeWriter $codewriter) {}
41
+    public function after(PHPTAL_Php_CodeWriter $codewriter) {}
42 42
 }
43 43
 
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/I18N/Attributes.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                     $code = $this->_getTranslationCode($codewriter, $attr->getValue());
81 81
                 } elseif ($attr->getReplacedState() === PHPTAL_Dom_Attr::VALUE_REPLACED && $attr->getOverwrittenVariableName()) {
82 82
                     // sadly variables won't be interpolated in this translation
83
-                    $code = 'echo '.$codewriter->escapeCode($codewriter->getTranslatorReference(). '->translate('.$attr->getOverwrittenVariableName().', false)');
83
+                    $code = 'echo '.$codewriter->escapeCode($codewriter->getTranslatorReference().'->translate('.$attr->getOverwrittenVariableName().', false)');
84 84
                 } else {
85 85
                     throw new PHPTAL_TemplateException("Unable to translate attribute $qname, because other TAL attributes are using it",
86 86
                                 $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             array_shift($m);
105 105
             $m = array_shift($m);
106 106
             foreach ($m as $name) {
107
-                $code .= "\n".$codewriter->getTranslatorReference(). '->setVar('.$codewriter->str($name).','.PHPTAL_Php_TalesInternal::compileToPHPExpression($name).');'; // allow more complex TAL expressions
107
+                $code .= "\n".$codewriter->getTranslatorReference().'->setVar('.$codewriter->str($name).','.PHPTAL_Php_TalesInternal::compileToPHPExpression($name).');'; // allow more complex TAL expressions
108 108
             }
109 109
             $code .= "\n";
110 110
         }
Please login to merge, or discard this 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/Data.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
  */
31 31
 class PHPTAL_Php_Attribute_I18N_Data extends PHPTAL_Php_Attribute
32 32
 {
33
-    public function before(PHPTAL_Php_CodeWriter $codewriter){}
34
-    public function after(PHPTAL_Php_CodeWriter $codewriter){}
33
+    public function before(PHPTAL_Php_CodeWriter $codewriter) {}
34
+    public function after(PHPTAL_Php_CodeWriter $codewriter) {}
35 35
 }
36 36
 
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/I18N/Source.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         $codewriter->end();
36 36
 
37 37
         // push current source and use new one
38
-        $codewriter->pushCode('$_i18n_sources[] = ' . $codewriter->getTranslatorReference(). '->setSource('.$codewriter->str($this->expression).')');
38
+        $codewriter->pushCode('$_i18n_sources[] = '.$codewriter->getTranslatorReference().'->setSource('.$codewriter->str($this->expression).')');
39 39
     }
40 40
 
41 41
     public function after(PHPTAL_Php_CodeWriter $codewriter)
Please login to merge, or discard this patch.
classes/PHPTAL/Php/Attribute/METAL/UseMacro.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,14 +52,14 @@
 block discarded – undo
52 52
 
53 53
         $macroname = strtr($this->expression, '-', '_');
54 54
 
55
-	// throw error if attempting to define and use macro at same time
56
-	// [should perhaps be a TemplateException? but I don't know how to set that up...]
57
-	if ($defineAttr = $this->phpelement->getAttributeNodeNS(
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());			
62
-	}
55
+    // throw error if attempting to define and use macro at same time
56
+    // [should perhaps be a TemplateException? but I don't know how to set that up...]
57
+    if ($defineAttr = $this->phpelement->getAttributeNodeNS(
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());			
62
+    }
63 63
 
64 64
         // local macro (no filename specified) and non dynamic macro name
65 65
         // can be called directly if it's a known function (just generated or seen in previous compilation)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         // local macro (no filename specified) and non dynamic macro name
65 65
         // can be called directly if it's a known function (just generated or seen in previous compilation)
66 66
         if (preg_match('/^[a-z0-9_]+$/i', $macroname) && $codewriter->functionExists($macroname)) {
67
-            $code = $codewriter->getFunctionPrefix() . $macroname . '($_thistpl, $tpl)';
67
+            $code = $codewriter->getFunctionPrefix().$macroname.'($_thistpl, $tpl)';
68 68
             $codewriter->pushCode($code);
69 69
         }
70 70
         // external macro or ${macroname}, use PHPTAL at runtime to resolve it
Please login to merge, or discard this 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.