Completed
Branch 1.3.x (b833d8)
by Ben
05:10
created
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 1 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.
classes/PHPTAL/Php/Attribute/METAL/FillSlot.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
             return 0;
106 106
         }
107 107
 
108
-        $estimated_bytes = 2*(3+strlen($element->getQualifiedName()));
108
+        $estimated_bytes = 2 * (3+strlen($element->getQualifiedName()));
109 109
 
110 110
         foreach ($element->getAttributeNodes() as $attr) {
111 111
             $estimated_bytes += 4+strlen($attr->getQualifiedName());
Please login to merge, or discard this patch.
classes/PHPTAL/Php/State.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public function interpolateTalesVarsInString($string)
146 146
     {
147
-        return PHPTAL_Php_TalesInternal::parseString($string, false, ($this->getTalesMode() === 'tales') ? '' : 'php:' );
147
+        return PHPTAL_Php_TalesInternal::parseString($string, false, ($this->getTalesMode() === 'tales') ? '' : 'php:');
148 148
     }
149 149
 
150 150
     /**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     public function interpolateTalesVarsInHTML($src)
154 154
     {
155 155
         return preg_replace_callback('/((?:\$\$)*)\$\{(structure |text )?(.*?)\}|((?:\$\$)+)\{/isS',
156
-                                     array($this,'_interpolateTalesVarsInHTMLCallback'), $src);
156
+                                     array($this, '_interpolateTalesVarsInHTMLCallback'), $src);
157 157
     }
158 158
 
159 159
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     public function interpolateTalesVarsInCDATA($src)
173 173
     {
174 174
         return preg_replace_callback('/((?:\$\$)*)\$\{(structure |text )?(.*?)\}|((?:\$\$)+)\{/isS',
175
-                                     array($this,'_interpolateTalesVarsInCDATACallback'), $src);
175
+                                     array($this, '_interpolateTalesVarsInCDATACallback'), $src);
176 176
     }
177 177
 
178 178
     /**
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
     {
188 188
         // replaces $${ with literal ${ (or $$$${ with $${ etc)
189 189
         if (!empty($matches[4])) {
190
-            return substr($matches[4], strlen($matches[4])/2).'{';
190
+            return substr($matches[4], strlen($matches[4]) / 2).'{';
191 191
         }
192 192
 
193 193
         // same replacement, but before executed expression
194
-        $dollars = substr($matches[1], strlen($matches[1])/2);
194
+        $dollars = substr($matches[1], strlen($matches[1]) / 2);
195 195
 
196 196
         $code = $matches[3];
197 197
         if ($format == 'html') {
Please login to merge, or discard this patch.
classes/PHPTAL/Php/CodeWriter.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * max id of variable to give as temp
26 26
      */
27
-    private $temp_var_counter=0;
27
+    private $temp_var_counter = 0;
28 28
     /**
29 29
      * stack with free'd variables
30 30
      */
31
-    private $temp_recycling=array();
31
+    private $temp_recycling = array();
32 32
 
33 33
     /**
34 34
      * keeps track of seen functions for function_exists
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function recycleTempVariable($var)
51 51
     {
52
-        if (substr($var, 0, 6)!=='$_tmp_') throw new PHPTAL_Exception("Invalid variable recycled");
52
+        if (substr($var, 0, 6) !== '$_tmp_') throw new PHPTAL_Exception("Invalid variable recycled");
53 53
         $this->temp_recycling[] = $var;
54 54
     }
55 55
 
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 
141 141
     public function indent()
142 142
     {
143
-        $this->_indentation ++;
143
+        $this->_indentation++;
144 144
     }
145 145
 
146 146
     public function unindent()
147 147
     {
148
-        $this->_indentation --;
148
+        $this->_indentation--;
149 149
     }
150 150
 
151 151
     public function flush()
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             }
188 188
             $this->_result .= $codeLine;
189 189
         }
190
-        $this->_result .= "?>\n";// PHP consumes newline
190
+        $this->_result .= "?>\n"; // PHP consumes newline
191 191
         $this->_codeBuffer = array();
192 192
     }
193 193
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     public function doDoctype($called_from_macro = false)
208 208
     {
209 209
         if ($this->_doctype) {
210
-            $code = '$ctx->setDocType('.$this->str($this->_doctype).','.($called_from_macro?'true':'false').')';
210
+            $code = '$ctx->setDocType('.$this->str($this->_doctype).','.($called_from_macro ? 'true' : 'false').')';
211 211
             $this->pushCode($code);
212 212
         }
213 213
     }
@@ -220,21 +220,21 @@  discard block
 block discarded – undo
220 220
     public function doXmlDeclaration($called_from_macro = false)
221 221
     {
222 222
         if ($this->_xmldeclaration && $this->getOutputMode() !== PHPTAL::HTML5) {
223
-            $code = '$ctx->setXmlDeclaration('.$this->str($this->_xmldeclaration).','.($called_from_macro?'true':'false').')';
223
+            $code = '$ctx->setXmlDeclaration('.$this->str($this->_xmldeclaration).','.($called_from_macro ? 'true' : 'false').')';
224 224
             $this->pushCode($code);
225 225
         }
226 226
     }
227 227
 
228 228
     public function functionExists($name)
229 229
     {
230
-        return isset($this->known_functions[$this->_functionPrefix . $name]);
230
+        return isset($this->known_functions[$this->_functionPrefix.$name]);
231 231
     }
232 232
 
233 233
     public function doTemplateFile($functionName, PHPTAL_Dom_Element $treeGen)
234 234
     {
235 235
         $this->doComment("\n*** DO NOT EDIT THIS FILE ***\n\nGenerated by PHPTAL from ".$treeGen->getSourceFile()." (edit that file instead)");
236 236
         $this->doFunction($functionName, 'PHPTAL $tpl, PHPTAL_Context $ctx');
237
-        $this->setFunctionPrefix($functionName . "_");
237
+        $this->setFunctionPrefix($functionName."_");
238 238
         $this->doSetVar('$_thistpl', '$tpl');
239 239
         $this->doInitTranslator();
240 240
         $treeGen->generateCode($this);
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
 
245 245
     public function doFunction($name, $params)
246 246
     {
247
-        $name = $this->_functionPrefix . $name;
247
+        $name = $this->_functionPrefix.$name;
248 248
         $this->known_functions[$name] = true;
249 249
 
250 250
         $this->pushCodeWriterContext();
251 251
         $this->pushCode("function $name($params) {\n");
252 252
         $this->indent();
253
-        $this->_segments[] =  'function';
253
+        $this->_segments[] = 'function';
254 254
     }
255 255
 
256 256
     public function doComment($comment)
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
     public function doForeach($out, $source)
283 283
     {
284
-        $this->_segments[] =  'foreach';
284
+        $this->_segments[] = 'foreach';
285 285
         $this->pushCode("foreach ($source as $out):");
286 286
         $this->indent();
287 287
     }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             $this->flush();
305 305
             $functionCode = $this->_result;
306 306
             $this->popCodeWriterContext();
307
-            $this->_result = $functionCode . $this->_result;
307
+            $this->_result = $functionCode.$this->_result;
308 308
         } elseif ($segment == 'try')
309 309
             $this->pushCode('}');
310 310
         elseif ($segment == 'catch')
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
     public function doTry()
317 317
     {
318
-        $this->_segments[] =  'try';
318
+        $this->_segments[] = 'try';
319 319
         $this->pushCode('try {');
320 320
         $this->indent();
321 321
     }
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
     public function doCatch($catch)
329 329
     {
330 330
         $this->doEnd('try');
331
-        $this->_segments[] =  'catch';
331
+        $this->_segments[] = 'catch';
332 332
         $this->pushCode('catch('.$catch.') {');
333 333
         $this->indent();
334 334
     }
335 335
 
336 336
     public function doIf($condition)
337 337
     {
338
-        $this->_segments[] =  'if';
338
+        $this->_segments[] = 'if';
339 339
         $this->pushCode('if ('.$condition.'): ');
340 340
         $this->indent();
341 341
     }
@@ -387,14 +387,14 @@  discard block
 block discarded – undo
387 387
     {
388 388
         if ($html === "") return;
389 389
         $this->flushCode();
390
-        $this->_htmlBuffer[] =  $html;
390
+        $this->_htmlBuffer[] = $html;
391 391
     }
392 392
 
393 393
     public function pushCode($codeLine)
394 394
     {
395 395
         $this->flushHtml();
396
-        $codeLine = $this->indentSpaces() . $codeLine;
397
-        $this->_codeBuffer[] =  $codeLine;
396
+        $codeLine = $this->indentSpaces().$codeLine;
397
+        $this->_codeBuffer[] = $codeLine;
398 398
     }
399 399
 
400 400
     /**
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
      */
403 403
     public function str($string)
404 404
     {
405
-        return "'".strtr($string,array("'"=>'\\\'','\\'=>'\\\\'))."'";
405
+        return "'".strtr($string, array("'"=>'\\\'', '\\'=>'\\\\'))."'";
406 406
     }
407 407
 
408 408
     public function escapeCode($code)
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
     private function pushCodeWriterContext()
481 481
     {
482
-        $this->_contexts[] =  clone $this;
482
+        $this->_contexts[] = clone $this;
483 483
         $this->_result = "";
484 484
         $this->_indentation = 0;
485 485
         $this->_codeBuffer = array();
Please login to merge, or discard this patch.
classes/PHPTAL/Php/TalesInternal.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     static public function true($src, $nothrow)
57 57
     {
58
-        return 'phptal_true(' . self::compileToPHPExpression($src, true) . ')';
58
+        return 'phptal_true('.self::compileToPHPExpression($src, true).')';
59 59
     }
60 60
 
61 61
     /**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     static public function not($expression, $nothrow)
86 86
     {
87
-        return '!phptal_true(' . self::compileToPHPExpression($expression, $nothrow) . ')';
87
+        return '!phptal_true('.self::compileToPHPExpression($expression, $nothrow).')';
88 88
     }
89 89
 
90 90
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      *
122 122
      * @returns string or array
123 123
      */
124
-    static public function path($expression, $nothrow=false)
124
+    static public function path($expression, $nothrow = false)
125 125
     {
126 126
         $expression = trim($expression);
127 127
         if ($expression == 'default') return self::DEFAULT_KEYWORD;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         if (count($exps) > 1 || isset($string)) {
147 147
             $result = array();
148 148
             foreach ($exps as $i=>$exp) {
149
-                if(isset($string) || $i < count($exps) - 1) {
149
+                if (isset($string) || $i < count($exps)-1) {
150 150
                     $result[] = self::compileToPHPExpressions(trim($exp), true);
151 151
                 }
152 152
                 else {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         }
181 181
 
182 182
         if ($nothrow) {
183
-            return '$ctx->path($ctx, ' . $next . ($expression === null ? '' : '."/".'.$expression) . ', true)';
183
+            return '$ctx->path($ctx, '.$next.($expression === null ? '' : '."/".'.$expression).', true)';
184 184
         }
185 185
 
186 186
         if (preg_match('/^\'[a-z][a-z0-9_]*\'$/i', $next)) $next = substr($next, 1, -1); else $next = '{'.$next.'}';
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      *      string:hello, ${user/name}
222 222
      *      string:you have $$130 in your bank account
223 223
      */
224
-    static public function string($expression, $nothrow=false)
224
+    static public function string($expression, $nothrow = false)
225 225
     {
226 226
         return self::parseString($expression, $nothrow, '');
227 227
     }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $lastWasDollar = false;
242 242
         $result = '';
243 243
         $len = strlen($expression);
244
-        for ($i=0; $i<$len; $i++) {
244
+        for ($i = 0; $i < $len; $i++) {
245 245
             $c = $expression[$i];
246 246
             switch ($c) {
247 247
                 case '$':
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
                 case '}':
292 292
                     if ($inAccoladePath) {
293 293
                         $inAccoladePath = false;
294
-                        $subEval = self::compileToPHPExpression($tales_prefix.$subPath,false);
295
-                        $result .= "'.(" . $subEval . ").'";
294
+                        $subEval = self::compileToPHPExpression($tales_prefix.$subPath, false);
295
+                        $result .= "'.(".$subEval.").'";
296 296
                         $subPath = '';
297 297
                         $lastWasDollar = false;
298 298
                         $c = '';
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
                             $c = '';
316 316
                         } else {
317 317
                             $inPath = false;
318
-                            $subEval = self::compileToPHPExpression($tales_prefix.$subPath,false);
319
-                            $result .= "'.(" . $subEval . ").'";
318
+                            $subEval = self::compileToPHPExpression($tales_prefix.$subPath, false);
319
+                            $result .= "'.(".$subEval.").'";
320 320
                             }
321 321
                         }
322 322
                     break;
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         }
326 326
         if ($inPath) {
327 327
             $subEval = self::compileToPHPExpression($tales_prefix.$subPath, false);
328
-            $result .= "'.(" . $subEval . ").'";
328
+            $result .= "'.(".$subEval.").'";
329 329
         }
330 330
 
331 331
         // optimize ''.foo.'' to foo
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         $src = rawurldecode($src);
366 366
 
367 367
         // Simple echo can be supported via regular method
368
-        if (preg_match('/^\s*echo\s+((?:[^;]+|"[^"\\\\]*"|\'[^\'\\\\]*\'|\/\*.*?\*\/)+);*\s*$/s',$src,$m))
368
+        if (preg_match('/^\s*echo\s+((?:[^;]+|"[^"\\\\]*"|\'[^\'\\\\]*\'|\/\*.*?\*\/)+);*\s*$/s', $src, $m))
369 369
         {
370 370
             return $m[1];
371 371
         }
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
     {
386 386
         $src = trim($src);
387 387
         if (ctype_alnum($src)) return 'isset($ctx->'.$src.')';
388
-        return '(null !== ' . self::compileToPHPExpression($src, true) . ')';
388
+        return '(null !== '.self::compileToPHPExpression($src, true).')';
389 389
     }
390 390
 
391 391
     /**
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      */
405 405
     static public function json($src, $nothrow)
406 406
     {
407
-        return 'json_encode('.phptal_tale($src,$nothrow).')';
407
+        return 'json_encode('.phptal_tale($src, $nothrow).')';
408 408
     }
409 409
 
410 410
     /**
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
      */
413 413
     static public function urlencode($src, $nothrow)
414 414
     {
415
-        return 'rawurlencode('.phptal_tale($src,$nothrow).')';
415
+        return 'rawurlencode('.phptal_tale($src, $nothrow).')';
416 416
     }
417 417
 
418 418
     /**
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
      * @see PHPTAL_Php_TalesInternal::compileToPHPExpressions()
423 423
      * @return string
424 424
      */
425
-    public static function compileToPHPExpression($expression, $nothrow=false)
425
+    public static function compileToPHPExpression($expression, $nothrow = false)
426 426
     {
427 427
         $r = self::compileToPHPExpressions($expression, $nothrow);
428 428
         if (!is_array($r)) return $r;
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
      */
438 438
     private static function convertExpressionsToExpression(array $array, $nothrow)
439 439
     {
440
-        if (count($array)==1) return '($ctx->noThrow('.($nothrow?'true':'false').')||1?('.
441
-            ($array[0]==self::NOTHING_KEYWORD?'null':$array[0]).
440
+        if (count($array) == 1) return '($ctx->noThrow('.($nothrow ? 'true' : 'false').')||1?('.
441
+            ($array[0] == self::NOTHING_KEYWORD ? 'null' : $array[0]).
442 442
             '):"")';
443 443
 
444 444
         $expr = array_shift($array);
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
      *
458 458
      * @return string or array
459 459
      */
460
-    public static function compileToPHPExpressions($expression, $nothrow=false)
460
+    public static function compileToPHPExpressions($expression, $nothrow = false)
461 461
     {
462 462
         $expression = trim($expression);
463 463
 
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
         throw new PHPTAL_UnknownModifierException("Unknown phptal modifier '$typePrefix'. Function '$func' does not exist", $typePrefix);
489 489
     }
490 490
 
491
-    private static function verifyPHPExpressions($typePrefix,$expressions)
491
+    private static function verifyPHPExpressions($typePrefix, $expressions)
492 492
     {
493 493
         if (!is_array($expressions)) {
494 494
             $expressions = array($expressions);
495 495
         }
496 496
 
497
-        foreach($expressions as $expr) {
497
+        foreach ($expressions as $expr) {
498 498
             if (preg_match('/;\s*$/', $expr)) {
499 499
                 throw new PHPTAL_ParserException("Modifier $typePrefix generated PHP statement rather than expression (don't add semicolons)");
500 500
             }
Please login to merge, or discard this patch.
classes/PHPTAL/RepeatController.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function __construct($source)
59 59
     {
60
-        if ( is_string($source) ) {
61
-            $this->iterator = new ArrayIterator( str_split($source) );  // FIXME: invalid for UTF-8 encoding, use preg_match_all('/./u') trick
62
-        } elseif ( is_array($source) ) {
60
+        if (is_string($source)) {
61
+            $this->iterator = new ArrayIterator(str_split($source)); // FIXME: invalid for UTF-8 encoding, use preg_match_all('/./u') trick
62
+        } elseif (is_array($source)) {
63 63
             $this->iterator = new ArrayIterator($source);
64 64
         } elseif ($source instanceof IteratorAggregate) {
65 65
             $this->iterator = $source->getIterator();
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
         } elseif ($source instanceof Traversable) {
75 75
             $this->iterator = new IteratorIterator($source);
76 76
         } elseif ($source instanceof Closure) {
77
-            $this->iterator = new ArrayIterator( (array) $source() );
77
+            $this->iterator = new ArrayIterator((array) $source());
78 78
         } elseif ($source instanceof stdClass) {
79
-            $this->iterator = new ArrayIterator( (array) $source );
79
+            $this->iterator = new ArrayIterator((array) $source);
80 80
         } else {
81
-            $this->iterator = new ArrayIterator( array() );
81
+            $this->iterator = new ArrayIterator(array());
82 82
         }
83 83
     }
84 84
 
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
         if ($this->length === null) {
121 121
             if ($this->iterator instanceof Countable) {
122 122
                 return $this->length = count($this->iterator);
123
-            } elseif ( is_object($this->iterator) ) {
123
+            } elseif (is_object($this->iterator)) {
124 124
                 // for backwards compatibility with existing PHPTAL templates
125
-                if ( method_exists($this->iterator, 'size') ) {
125
+                if (method_exists($this->iterator, 'size')) {
126 126
                     return $this->length = $this->iterator->size();
127
-                } elseif ( method_exists($this->iterator, 'length') ) {
127
+                } elseif (method_exists($this->iterator, 'length')) {
128 128
                     return $this->length = $this->iterator->length();
129 129
                 }
130 130
             }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
         if ($this->length === '_PHPTAL_LENGTH_UNKNOWN_') // return length if end is discovered
135 135
         {
136
-            return $this->end ? $this->index + 1 : null;
136
+            return $this->end ? $this->index+1 : null;
137 137
         }
138 138
         return $this->length;
139 139
     }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     {
204 204
         switch ($var) {
205 205
             case 'number':
206
-                return $this->index + 1;
206
+                return $this->index+1;
207 207
             case 'start':
208 208
                 return $this->index === 0;
209 209
             case 'even':
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
             case 'length':
214 214
                 return $this->length();
215 215
             case 'letter':
216
-                return strtolower( $this->int2letter($this->index+1) );
216
+                return strtolower($this->int2letter($this->index+1));
217 217
             case 'Letter':
218
-                return strtoupper( $this->int2letter($this->index+1) );
218
+                return strtoupper($this->int2letter($this->index+1));
219 219
             case 'roman':
220
-                return strtolower( $this->int2roman($this->index+1) );
220
+                return strtolower($this->int2roman($this->index+1));
221 221
             case 'Roman':
222
-                return strtoupper( $this->int2roman($this->index+1) );
222
+                return strtoupper($this->int2roman($this->index+1));
223 223
 
224 224
             case 'groups':
225 225
                 $this->initializeGroups();
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             case 'last':
235 235
                 $this->initializeGroups();
236 236
                 // Compare the next one with the dictionary
237
-                $res = $this->groups->last( $this->iterator->current() );
237
+                $res = $this->groups->last($this->iterator->current());
238 238
                 return is_bool($res) ? $res : $this->groups;
239 239
 
240 240
             default:
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         $this->key = $this->iterator->key();
256 256
 
257 257
         $this->iterator->next();
258
-        if ( !$this->iterator->valid() ) {
258
+        if (!$this->iterator->valid()) {
259 259
             $this->valid = false;
260 260
             $this->end = true;
261 261
         }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         $letters = '';
278 278
         while ($int > 0) {
279 279
             $int--;
280
-            $letters = $lookup[$int % $size] . $letters;
280
+            $letters = $lookup[$int % $size].$letters;
281 281
             $int = floor($int / $size);
282 282
         }
283 283
         return $letters;
Please login to merge, or discard this patch.
classes/PHPTAL/RepeatControllerGroups.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function first($data)
56 56
     {
57
-        if ( !is_array($data) && !is_object($data) && !is_null($data) ) {
57
+        if (!is_array($data) && !is_object($data) && !is_null($data)) {
58 58
 
59
-            if ( !isset($this->cache['F']) ) {
59
+            if (!isset($this->cache['F'])) {
60 60
 
61 61
                 $hash = md5($data);
62 62
 
63
-                if ( !isset($this->dict['F']) || $this->dict['F'] !== $hash ) {
63
+                if (!isset($this->dict['F']) || $this->dict['F'] !== $hash) {
64 64
                     $this->dict['F'] = $hash;
65 65
                     $res = true;
66 66
                 } else {
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function last($data)
91 91
     {
92
-        if ( !is_array($data) && !is_object($data) && !is_null($data) ) {
92
+        if (!is_array($data) && !is_object($data) && !is_null($data)) {
93 93
 
94
-            if ( !isset($this->cache['L']) ) {
94
+            if (!isset($this->cache['L'])) {
95 95
 
96 96
                 $hash = md5($data);
97 97
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         // When the iterator item is empty we just let the tal
132 132
         // expression consume by continuously returning this
133 133
         // same object which should evaluate to true for 'last'
134
-        if ( is_null($this->data) ) {
134
+        if (is_null($this->data)) {
135 135
             return $this;
136 136
         }
137 137
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         $value = PHPTAL_Context::path($this->data, $var, true);
140 140
 
141 141
         // Check if it's an object or an array
142
-        if ( is_array($value) || is_object($value) ) {
142
+        if (is_array($value) || is_object($value)) {
143 143
             // Move the context to the requested variable and return
144 144
             $this->data = $value;
145 145
             $this->addVarName($var);
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
         $hash = md5($value);
151 151
 
152 152
         // compute a path for the variable to use as dictionary key
153
-        $path = $this->branch . $this->getVarPath() . $var;
153
+        $path = $this->branch.$this->getVarPath().$var;
154 154
 
155 155
         // If we don't know about this var store in the dictionary
156
-        if ( !isset($this->cache[$path]) ) {
156
+        if (!isset($this->cache[$path])) {
157 157
 
158
-            if ( !isset($this->dict[$path]) ) {
158
+            if (!isset($this->dict[$path])) {
159 159
                 $this->dict[$path] = $hash;
160 160
                 $res = $this->branch === 'F';
161 161
             } else {
@@ -194,6 +194,6 @@  discard block
 block discarded – undo
194 194
      */
195 195
     protected function getVarPath()
196 196
     {
197
-        return implode('/', $this->vars) . '/';
197
+        return implode('/', $this->vars).'/';
198 198
     }
199 199
 }
Please login to merge, or discard this patch.
classes/PHPTAL/PreFilter/Normalize.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                     $root->removeChild($node);
51 51
                 } else if ($lastTextNode) {
52 52
                     // "foo " . " bar" gives 2 spaces.
53
-                    $norm = $lastTextNode->getValueEscaped().ltrim($norm,' ');
53
+                    $norm = $lastTextNode->getValueEscaped().ltrim($norm, ' ');
54 54
 
55 55
                     $lastTextNode->setValueEscaped($norm); // assumes all nodes use same encoding (they do)
56 56
                     $root->removeChild($node);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected function normalizeSpace($text, $encoding)
91 91
     {
92
-        $utf_regex_mod = ($encoding=='UTF-8'?'u':'');
92
+        $utf_regex_mod = ($encoding == 'UTF-8' ? 'u' : '');
93 93
 
94 94
         return preg_replace('/[ \t\r\n]+/'.$utf_regex_mod, ' ', $text); // \s removes nbsp
95 95
     }
Please login to merge, or discard this patch.