Completed
Pull Request — master (#74)
by
unknown
02:41 queued 35s
created
classes/PHPTAL.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
      * Get output mode
361 361
      * @see setOutputMode()
362 362
      *
363
-     * @return output mode constant
363
+     * @return integer mode constant
364 364
      */
365 365
     public function getOutputMode()
366 366
     {
@@ -389,9 +389,8 @@  discard block
 block discarded – undo
389 389
     /**
390 390
      * Get input and ouput encoding.
391 391
      *
392
-     * @param string $enc example: 'UTF-8'
393 392
      *
394
-     * @return $this
393
+     * @return string
395 394
      */
396 395
     public function getEncoding()
397 396
     {
@@ -743,6 +742,7 @@  discard block
 block discarded – undo
743 742
      *
744 743
      * @param PHPTAL $local_tpl is PHPTAL instance of the file in which macro is defined
745 744
      *                          (it will be different from $this if it's external macro call)
745
+     * @param string $path
746 746
      * @access private
747 747
      */
748 748
     final public function _executeMacroOfTemplate($path, PHPTAL $local_tpl)
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @param string $path Template file path.
177 177
      */
178
-    public function __construct($path=false)
178
+    public function __construct($path = false)
179 179
     {
180 180
         $this->_path = $path;
181 181
         $this->_globalContext = new stdClass();
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      *
204 204
      * @return PHPTAL
205 205
      */
206
-    public static function create($path=false)
206
+    public static function create($path = false)
207 207
     {
208 208
         return new PHPTAL($path);
209 209
     }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
      */
409 409
     public function setPhpCodeDestination($path)
410 410
     {
411
-        $this->_phpCodeDestination = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
411
+        $this->_phpCodeDestination = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
412 412
         $this->resetPrepared();
413 413
         return $this;
414 414
     }
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     private function getPreFiltersCacheId()
549 549
     {
550 550
         $cacheid = '';
551
-        foreach($this->getPreFilters() as $key => $prefilter) {
551
+        foreach ($this->getPreFilters() as $key => $prefilter) {
552 552
             if ($prefilter instanceof PHPTAL_PreFilter) {
553 553
                 $cacheid .= $key.$prefilter->getCacheId();
554 554
             } elseif ($prefilter instanceof PHPTAL_Filter) {
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
     {
570 570
         $prefilters = $this->getPreFilters();
571 571
 
572
-        foreach($prefilters as $prefilter) {
572
+        foreach ($prefilters as $prefilter) {
573 573
             if ($prefilter instanceof PHPTAL_PreFilter) {
574 574
                 $prefilter->setPHPTAL($this);
575 575
             }
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 
676 676
             // unshift doctype
677 677
             if ($this->_context->_docType) {
678
-                $res = $this->_context->_docType . $res;
678
+                $res = $this->_context->_docType.$res;
679 679
             }
680 680
 
681 681
             // unshift xml declaration
682 682
             if ($this->_context->_xmlDeclaration) {
683
-                $res = $this->_context->_xmlDeclaration . "\n" . $res;
683
+                $res = $this->_context->_xmlDeclaration."\n".$res;
684 684
             }
685 685
 
686 686
             if ($this->_postfilter) {
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
                 $this->externalMacroTemplatesCache[$file] = $tpl;
769 769
             }
770 770
 
771
-            $fun = $tpl->getFunctionName() . '_' . strtr($macroName, "-", "_");
771
+            $fun = $tpl->getFunctionName().'_'.strtr($macroName, "-", "_");
772 772
             if (!function_exists($fun)) {
773 773
                 throw new PHPTAL_MacroMissingException("Macro '$macroName' is not defined in $file", $this->_source->getRealPath());
774 774
             }
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
 
778 778
         } else {
779 779
             // call local macro
780
-            $fun = $local_tpl->getFunctionName() . '_' . strtr($path, "-", "_");
780
+            $fun = $local_tpl->getFunctionName().'_'.strtr($path, "-", "_");
781 781
             if (!function_exists($fun)) {
782 782
                 throw new PHPTAL_MacroMissingException("Macro '$path' is not defined", $local_tpl->_source->getRealPath());
783 783
             }
784
-            $fun( $local_tpl, $this);
784
+            $fun($local_tpl, $this);
785 785
         }
786 786
     }
787 787
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
     private function setCodeFile()
792 792
     {
793 793
         $this->findTemplate();
794
-        $this->_codeFile = $this->getPhpCodeDestination() . $this->getFunctionName() . '.' . $this->getPhpCodeExtension();
794
+        $this->_codeFile = $this->getPhpCodeDestination().$this->getFunctionName().'.'.$this->getPhpCodeExtension();
795 795
     }
796 796
 
797 797
     protected function resetPrepared()
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 
820 820
                 // i'm not sure where that belongs, but not in normal path of execution
821 821
                 // because some sites have _a lot_ of files in temp
822
-                if ($this->getCachePurgeFrequency() && mt_rand()%$this->getCachePurgeFrequency() == 0) {
822
+                if ($this->getCachePurgeFrequency() && mt_rand() % $this->getCachePurgeFrequency() == 0) {
823 823
                     $this->cleanUpGarbage();
824 824
                 }
825 825
 
@@ -836,16 +836,16 @@  discard block
 block discarded – undo
836 836
                 try {
837 837
                     eval("?>\n".$result);
838 838
                 }
839
-                catch(ParseError $parseError) {
839
+                catch (ParseError $parseError) {
840 840
                     ob_end_clean();
841 841
                     throw new PHPTAL_TemplateException(
842
-                        'Parse error: ' . $parseError->getMessage(),
842
+                        'Parse error: '.$parseError->getMessage(),
843 843
                         $this->getCodePath(),
844 844
                         $parseError->getLine(),
845 845
                         $parseError
846 846
                     );
847 847
                 }
848
-                catch(Exception $e) {
848
+                catch (Exception $e) {
849 849
                     ob_end_clean();
850 850
                     throw $e;
851 851
                 }
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
                     $msg = str_replace('eval()\'d code', $this->getCodePath(), ob_get_clean());
855 855
 
856 856
                     // greedy .* ensures last match
857
-                    if (preg_match('/.*on line (\d+)$/m', $msg, $m)) $line=$m[1]; else $line=0;
857
+                    if (preg_match('/.*on line (\d+)$/m', $msg, $m)) $line = $m[1]; else $line = 0;
858 858
                     throw new PHPTAL_TemplateException(trim($msg), $this->getCodePath(), $line);
859 859
                 }
860 860
                 ob_end_clean();
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
      */
896 896
     public function setCachePurgeFrequency($n)
897 897
     {
898
-        $this->_cachePurgeFrequency = (int)$n;
898
+        $this->_cachePurgeFrequency = (int) $n;
899 899
         return $this;
900 900
     }
901 901
 
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
      */
916 916
     public function cleanUpGarbage()
917 917
     {
918
-        $cacheFilesExpire = time() - $this->getCacheLifetime() * 3600 * 24;
918
+        $cacheFilesExpire = time()-$this->getCacheLifetime() * 3600 * 24;
919 919
 
920 920
         // relies on templates sorting order being related to their modification dates
921
-        $upperLimit = $this->getPhpCodeDestination() . $this->getFunctionNamePrefix($cacheFilesExpire) . '_';
922
-        $lowerLimit = $this->getPhpCodeDestination() . $this->getFunctionNamePrefix(0);
921
+        $upperLimit = $this->getPhpCodeDestination().$this->getFunctionNamePrefix($cacheFilesExpire).'_';
922
+        $lowerLimit = $this->getPhpCodeDestination().$this->getFunctionNamePrefix(0);
923 923
 
924 924
         // second * gets phptal:cache
925
-        $cacheFiles = glob($this->getPhpCodeDestination() . 'tpl_????????_*.' . $this->getPhpCodeExtension() . '*');
925
+        $cacheFiles = glob($this->getPhpCodeDestination().'tpl_????????_*.'.$this->getPhpCodeExtension().'*');
926 926
 
927 927
         if ($cacheFiles) {
928 928
             foreach ($cacheFiles as $index => $file) {
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
     public function cleanUpCache()
946 946
     {
947 947
         $filename = $this->getCodePath();
948
-        $cacheFiles = glob($filename . '?*');
948
+        $cacheFiles = glob($filename.'?*');
949 949
         if ($cacheFiles) {
950 950
             foreach ($cacheFiles as $file) {
951 951
                 if (substr($file, 0, strlen($filename)) !== $filename) continue; // safety net
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
             $basename = preg_replace('/\.[a-z]{3,5}$/', '', basename($this->_source->getRealPath()));
985 985
             $basename = substr(trim(preg_replace('/[^a-zA-Z0-9]+/', '_', $basename), "_"), 0, 20);
986 986
 
987
-            $hash = md5(PHPTAL_VERSION . PHP_VERSION
987
+            $hash = md5(PHPTAL_VERSION.PHP_VERSION
988 988
                     . $this->_source->getRealPath()
989 989
                     . $this->getEncoding()
990 990
                     . $this->getPrefiltersCacheId()
@@ -995,10 +995,10 @@  discard block
 block discarded – undo
995 995
             // uses base64 rather than hex to make filename shorter.
996 996
             // there is loss of some bits due to name constraints and case-insensivity,
997 997
             // but that's still over 110 bits in addition to basename and timestamp.
998
-            $hash = strtr(rtrim(base64_encode($hash),"="),"+/=","_A_");
998
+            $hash = strtr(rtrim(base64_encode($hash), "="), "+/=", "_A_");
999 999
 
1000
-            $this->_functionName = $this->getFunctionNamePrefix($this->_source->getLastModifiedTime()) .
1001
-                                   $basename . '__' . $hash;
1000
+            $this->_functionName = $this->getFunctionNamePrefix($this->_source->getLastModifiedTime()).
1001
+                                   $basename.'__'.$hash;
1002 1002
         }
1003 1003
         return $this->_functionName;
1004 1004
     }
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
     {
1016 1016
         // tpl_ prefix and last modified time must not be changed,
1017 1017
         // because cache cleanup relies on that
1018
-        return 'tpl_' . sprintf("%08x", $timestamp) .'_';
1018
+        return 'tpl_'.sprintf("%08x", $timestamp).'_';
1019 1019
     }
1020 1020
 
1021 1021
     /**
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
      */
1046 1046
     public function addError(Exception $error)
1047 1047
     {
1048
-        $this->_errors[] =  $error;
1048
+        $this->_errors[] = $error;
1049 1049
     }
1050 1050
 
1051 1051
     /**
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
         $data = $this->_source->getData();
1102 1102
 
1103 1103
         $prefilters = $this->getPreFilterInstances();
1104
-        foreach($prefilters as $prefilter) {
1104
+        foreach ($prefilters as $prefilter) {
1105 1105
             $data = $prefilter->filter($data);
1106 1106
         }
1107 1107
 
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
         $builder = new PHPTAL_Dom_PHPTALDocumentBuilder();
1112 1112
         $tree = $parser->parseString($builder, $data, $realpath)->getResult();
1113 1113
 
1114
-        foreach($prefilters as $prefilter) {
1114
+        foreach ($prefilters as $prefilter) {
1115 1115
             if ($prefilter instanceof PHPTAL_PreFilter) {
1116 1116
                 if ($prefilter->filterDOM($tree) !== NULL) {
1117 1117
                     throw new PHPTAL_ConfigurationException("Don't return value from filterDOM()");
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 
1199 1199
         if (substr($class, 0, 7) !== 'PHPTAL_') return;
1200 1200
 
1201
-        $path = dirname(__FILE__) . strtr("_".$class, "_", DIRECTORY_SEPARATOR) . '.php';
1201
+        $path = dirname(__FILE__).strtr("_".$class, "_", DIRECTORY_SEPARATOR).'.php';
1202 1202
 
1203 1203
         require $path;
1204 1204
     }
@@ -1223,9 +1223,9 @@  discard block
 block discarded – undo
1223 1223
         // Prepending PHPTAL's autoloader helps if there are other autoloaders
1224 1224
         // that throw/die when file is not found. Only >5.3 though.
1225 1225
         if (version_compare(PHP_VERSION, '5.3', '>=')) {
1226
-            @spl_autoload_register(array(__CLASS__,'autoload'), false, true);
1226
+            @spl_autoload_register(array(__CLASS__, 'autoload'), false, true);
1227 1227
         } else {
1228
-            spl_autoload_register(array(__CLASS__,'autoload'));
1228
+            spl_autoload_register(array(__CLASS__, 'autoload'));
1229 1229
         }
1230 1230
 
1231 1231
         if ($uses_autoload) {
Please login to merge, or discard this patch.
classes/PHPTAL/Context.php 2 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * save current execution context
66 66
      *
67
-     * @return Context (new)
67
+     * @return PHPTAL_Context (new)
68 68
      */
69 69
     public function pushContext()
70 70
     {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     /**
77 77
      * get previously saved execution context
78 78
      *
79
-     * @return Context (old)
79
+     * @return PHPTAL_Context (old)
80 80
      */
81 81
     public function popContext()
82 82
     {
@@ -263,6 +263,7 @@  discard block
 block discarded – undo
263 263
     /**
264 264
      * Context setter.
265 265
      *
266
+     * @param string $varname
266 267
      * @return void
267 268
      */
268 269
     public function __set($varname, $value)
@@ -312,6 +313,7 @@  discard block
 block discarded – undo
312 313
      * helper method for PHPTAL_Context::path()
313 314
      *
314 315
      * @access private
316
+     * @param string $path
315 317
      */
316 318
     private static function pathError($base, $path, $current, $basename)
317 319
     {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return void
103 103
      */
104
-    public function setDocType($doctype,$called_from_macro)
104
+    public function setDocType($doctype, $called_from_macro)
105 105
     {
106 106
         // FIXME: this is temporary workaround for problem of DOCTYPE disappearing in cloned PHPTAL object (because clone keeps _parentContext)
107 107
         if (!$this->_docType) {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function pushSlots()
248 248
     {
249
-        $this->_slotsStack[] =  $this->_slots;
249
+        $this->_slotsStack[] = $this->_slots;
250 250
         $this->_slots = array();
251 251
     }
252 252
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         } else $pathinfo = '';
321 321
 
322 322
         if (!empty($basename)) {
323
-            $basename = "'" . $basename . "' ";
323
+            $basename = "'".$basename."' ";
324 324
         }
325 325
 
326 326
         if (is_array($base)) {
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
      * @access private
351 351
      * @return mixed
352 352
      */
353
-    public static function path($base, $path, $nothrow=false)
353
+    public static function path($base, $path, $nothrow = false)
354 354
     {
355 355
         if ($base === null) {
356 356
             if ($nothrow) return null;
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
                         $base = $base->__call($current, array());
415 415
                         continue;
416 416
                     }
417
-                    catch(BadMethodCallException $e) {}
417
+                    catch (BadMethodCallException $e) {}
418 418
                 }
419 419
 
420 420
                 if (is_callable($base)) {
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             // array handling
434 434
             if (is_array($base)) {
435 435
                 // key or index
436
-                if (array_key_exists((string)$current, $base)) {
436
+                if (array_key_exists((string) $current, $base)) {
437 437
                     $base = $base[$current];
438 438
                     continue;
439 439
                 }
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
  * @see PHPTAL_Context::path()
482 482
  * @deprecated
483 483
  */
484
-function phptal_path($base, $path, $nothrow=false)
484
+function phptal_path($base, $path, $nothrow = false)
485 485
 {
486 486
     return PHPTAL_Context::path($base, $path, $nothrow);
487 487
 }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 function phptal_isempty($var)
497 497
 {
498 498
     return $var === null || $var === false || $var === ''
499
-           || ((is_array($var) || $var instanceof Countable) && count($var)===0);
499
+           || ((is_array($var) || $var instanceof Countable) && count($var) === 0);
500 500
 }
501 501
 
502 502
 /**
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     if (is_string($var)) {
536 536
         return $var;
537 537
     } elseif (is_bool($var)) {
538
-        return (int)$var;
538
+        return (int) $var;
539 539
     } elseif (is_array($var)) {
540 540
         return implode(', ', array_map('phptal_tostring', $var));
541 541
     } elseif ($var instanceof SimpleXMLElement) {
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
             return $xml;
550 550
         }
551 551
     }
552
-    return (string)phptal_unravel_closure($var);
552
+    return (string) phptal_unravel_closure($var);
553 553
 }
554 554
 
555 555
 /**
Please login to merge, or discard this patch.
classes/PHPTAL/Dom/Attr.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
     /**
83 83
      * Returns true if this attribute is ns declaration (xmlns="...")
84 84
      *
85
-     * @return bool
85
+     * @return integer
86 86
      */
87 87
     function isNamespaceDeclaration()
88 88
     {
Please login to merge, or discard this patch.
classes/PHPTAL/Dom/Defs.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,6 @@
 block discarded – undo
52 52
      * true if it's empty in XHTML (e.g. <img/>)
53 53
      * it will assume elements with no namespace may be XHTML too.
54 54
      *
55
-     * @param string $tagName local name of the tag
56 55
      *
57 56
      * @return bool
58 57
      */
Please login to merge, or discard this patch.
classes/PHPTAL/Dom/Element.php 2 patches
Doc Comments   +8 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param string $qname           qualified name of the element, e.g. "tal:block"
41 41
      * @param string $namespace_uri   namespace of this element
42 42
      * @param array  $attribute_nodes array of PHPTAL_Dom_Attr elements
43
-     * @param object $xmlns           object that represents namespaces/prefixes known in element's context
43
+     * @param PHPTAL_Dom_XmlnsState $xmlns           object that represents namespaces/prefixes known in element's context
44 44
      */
45 45
     public function __construct($qname, $namespace_uri, array $attribute_nodes, PHPTAL_Dom_XmlnsState $xmlns)
46 46
     {
@@ -229,6 +229,10 @@  discard block
 block discarded – undo
229 229
         return null;
230 230
     }
231 231
 
232
+    /**
233
+     * @param string $ns_uri
234
+     * @param string $localname
235
+     */
232 236
     public function removeAttributeNS($ns_uri, $localname)
233 237
     {
234 238
         foreach ($this->attribute_nodes as $k => $attr) {
@@ -239,6 +243,9 @@  discard block
 block discarded – undo
239 243
         }
240 244
     }
241 245
 
246
+    /**
247
+     * @return PHPTAL_Php_CodeWriter
248
+     */
242 249
     public function getAttributeNode($qname)
243 250
     {
244 251
         foreach($this->attribute_nodes as $attr) if ($attr->getQualifiedName() === $qname) return $attr;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
             $this->generateSurroundFoot($codewriter);
185 185
         }
186
-        catch(PHPTAL_TemplateException $e) {
186
+        catch (PHPTAL_TemplateException $e) {
187 187
             $e->hintSrcPosition($this->getSourceFile(), $this->getSourceLine());
188 188
             throw $e;
189 189
         }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     /** Returns true if the element contains specified PHPTAL attribute. */
213 213
     public function hasAttribute($qname)
214 214
     {
215
-        foreach($this->attribute_nodes as $attr) if ($attr->getQualifiedName() == $qname) return true;
215
+        foreach ($this->attribute_nodes as $attr) if ($attr->getQualifiedName() == $qname) return true;
216 216
         return false;
217 217
     }
218 218
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
     public function getAttributeNode($qname)
243 243
     {
244
-        foreach($this->attribute_nodes as $attr) if ($attr->getQualifiedName() === $qname) return $attr;
244
+        foreach ($this->attribute_nodes as $attr) if ($attr->getQualifiedName() === $qname) return $attr;
245 245
         return null;
246 246
     }
247 247
 
@@ -348,15 +348,15 @@  discard block
 block discarded – undo
348 348
         }
349 349
     }
350 350
 
351
-    public function generateContent(PHPTAL_Php_CodeWriter $codewriter = null, $realContent=false)
351
+    public function generateContent(PHPTAL_Php_CodeWriter $codewriter = null, $realContent = false)
352 352
     {
353 353
         if (!$this->isEmptyNode($codewriter->getOutputMode())) {
354 354
             if ($realContent || !count($this->contentAttributes)) {
355
-                foreach($this->childNodes as $child) {
355
+                foreach ($this->childNodes as $child) {
356 356
                     $child->generateCode($codewriter);
357 357
                 }
358 358
             }
359
-            else foreach($this->contentAttributes as $att) {
359
+            else foreach ($this->contentAttributes as $att) {
360 360
                 $att->before($codewriter);
361 361
                 $att->after($codewriter);
362 362
             }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
     private function isEmptyNode($mode)
435 435
     {
436 436
         return (($mode === PHPTAL::XHTML || $mode === PHPTAL::HTML5) && PHPTAL_Dom_Defs::getInstance()->isEmptyTagNS($this->getNamespaceURI(), $this->getLocalName())) ||
437
-               ( $mode === PHPTAL::XML   && !$this->hasContent());
437
+               ($mode === PHPTAL::XML && !$this->hasContent());
438 438
     }
439 439
 
440 440
     private function hasContent()
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
                 throw new PHPTAL_TemplateException(sprintf("Attribute conflict in < %s > '%s' cannot appear with '%s'",
469 469
                                $this->qualifiedName,
470 470
                                $key,
471
-                               $temp[$nsattr->getPriority()][0]->getNamespace()->getPrefix() . ':' . $temp[$nsattr->getPriority()][0]->getLocalName()
471
+                               $temp[$nsattr->getPriority()][0]->getNamespace()->getPrefix().':'.$temp[$nsattr->getPriority()][0]->getLocalName()
472 472
                                ), $this->getSourceFile(), $this->getSourceLine());
473 473
             }
474 474
             $temp[$nsattr->getPriority()] = array($nsattr, $domattr);
Please login to merge, or discard this patch.
classes/PHPTAL/Dom/SaxXmlParser.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -80,6 +80,10 @@
 block discarded – undo
80 80
     );
81 81
 
82 82
     private $input_encoding;
83
+
84
+    /**
85
+     * @param string $input_encoding
86
+     */
83 87
     public function __construct($input_encoding)
84 88
     {
85 89
         $this->input_encoding = $input_encoding;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
             $builder->setSource($this->_file, $this->_line);
117 117
             $builder->onDocumentStart();
118 118
 
119
-            $i=0;
119
+            $i = 0;
120 120
             // remove BOM (UTF-8 byte order mark)...
121 121
             if (substr($src, 0, 3) === self::BOM_STR) {
122
-                $i=3;
122
+                $i = 3;
123 123
             }
124
-            for (; $i<$len; $i++) {
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 127
                 if ($c === "\n") $builder->setSource($this->_file, ++$this->_line);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                         if ($c !== '>') {
202 202
                             $this->raiseError("Expected '/>', but found '/$c' inside tag < $tagname >");
203 203
                         }
204
-                        $mark = $i+1;   // mark text start
204
+                        $mark = $i+1; // mark text start
205 205
                         $state = self::ST_TEXT;
206 206
                         $builder->onElementStart($tagname, $attributes);
207 207
                         $builder->onElementClose($tagname);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                     case self::ST_TAG_BETWEEN_ATTRIBUTE:
211 211
                     case self::ST_TAG_ATTRIBUTES:
212 212
                         if ($c === '>') {
213
-                            $mark = $i+1;   // mark text start
213
+                            $mark = $i+1; // mark text start
214 214
                             $state = self::ST_TEXT;
215 215
                             $builder->onElementStart($tagname, $attributes);
216 216
                         } elseif ($c === '/') {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                     case self::ST_COMMENT:
227 227
                         if ($c === '>' && $i > $mark+4 && substr($src, $i-2, 2) === '--') {
228 228
 
229
-                            if (preg_match('/^-|--|-$/', substr($src, $mark +4, $i-$mark+1 -7))) {
229
+                            if (preg_match('/^-|--|-$/', substr($src, $mark+4, $i-$mark+1-7))) {
230 230
                                 $this->raiseError("Ill-formed comment. XML comments are not allowed to contain '--' or start/end with '-': ".substr($src, $mark+4, $i-$mark+1-7));
231 231
                             }
232 232
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
                             if ($c === '=') $state = self::ST_ATTR_VALUE;
291 291
                             else /* white char */ $state = self::ST_ATTR_EQ;
292
-                        } elseif ($c === '/' || $c==='>') {
292
+                        } elseif ($c === '/' || $c === '>') {
293 293
                             $attribute = substr($src, $mark, $i-$mark);
294 294
                             if (!$this->isValidQName($attribute)) {
295 295
                                 $this->raiseError("Invalid attribute name '$attribute'");
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
                             // PHPTAL's code generator assumes input is escaped for double-quoted strings. Single-quoted attributes need to be converted.
325 325
                             // FIXME: it should be escaped at later stage.
326
-                            $attributes[$attribute] = str_replace('"',"&quot;", $attributes[$attribute]);
326
+                            $attributes[$attribute] = str_replace('"', "&quot;", $attributes[$attribute]);
327 327
                             $state = self::ST_TAG_BETWEEN_ATTRIBUTE;
328 328
                         }
329 329
                         break;
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
             $builder->onDocumentEnd();
349 349
         }
350
-        catch(PHPTAL_TemplateException $e)
350
+        catch (PHPTAL_TemplateException $e)
351 351
         {
352 352
             $e->hintSrcPosition($this->_file, $this->_line);
353 353
             throw $e;
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
             // $match expression below somehow triggers quite deep recurrency and stack overflow in preg
371 371
             // to avoid this, check string bit by bit, omitting ASCII fragments.
372 372
             if (strlen($str) > 200) {
373
-                $chunks = preg_split('/(?>[\x09\x0A\x0D\x20-\x7F]+)/',$str,null,PREG_SPLIT_NO_EMPTY);
373
+                $chunks = preg_split('/(?>[\x09\x0A\x0D\x20-\x7F]+)/', $str, null, PREG_SPLIT_NO_EMPTY);
374 374
                 foreach ($chunks as $chunk) {
375 375
                     if (strlen($chunk) < 200) {
376 376
                         $this->checkEncoding($chunk);
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
                . '|\xED[\x80-\x9F][\x80-\xBF]'        // excluding surrogates
390 390
                . '|\xF0[\x90-\xBF][\x80-\xBF]{2}'     // planes 1-3
391 391
                . '|[\xF1-\xF3][\x80-\xBF]{3}'         // planes 4-15
392
-               . '|\xF4[\x80-\x8F][\x80-\xBF]{2}';    // plane 16
392
+               . '|\xF4[\x80-\x8F][\x80-\xBF]{2}'; // plane 16
393 393
 
394
-            if (!preg_match('/^(?:(?>'.$match.'))+$/s',$str)) {
395
-                $res = preg_split('/((?>'.$match.')+)/s',$str,null,PREG_SPLIT_DELIM_CAPTURE);
396
-                for($i=0; $i < count($res); $i+=2)
394
+            if (!preg_match('/^(?:(?>'.$match.'))+$/s', $str)) {
395
+                $res = preg_split('/((?>'.$match.')+)/s', $str, null, PREG_SPLIT_DELIM_CAPTURE);
396
+                for ($i = 0; $i < count($res); $i += 2)
397 397
                 {
398 398
                     $res[$i] = self::convertBytesToEntities(array(1=>$res[$i]));
399 399
                 }
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
     {
427 427
         $m = $m[1];
428 428
         $out = "";
429
-        for($i=0; $i < strlen($m); $i++)
429
+        for ($i = 0; $i < strlen($m); $i++)
430 430
         {
431 431
             $out .= '&#X'.strtoupper(dechex(ord($m[$i]))).';';
432 432
         }
Please login to merge, or discard this patch.
classes/PHPTAL/ExceptionHandler.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -27,6 +27,7 @@
 block discarded – undo
27 27
      * Doesn't change exception handler if non-default one is set.
28 28
      *
29 29
      * @param Exception e exception to re-throw and display
30
+     * @param string $encoding
30 31
      *
31 32
      * @return void
32 33
      * @throws Exception
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@
 block discarded – undo
64 64
 
65 65
         if (ini_get('display_errors')) {
66 66
             $title = get_class($e).': '.htmlspecialchars($e->getMessage());
67
-            $body = "<p><strong>\n".htmlspecialchars($e->getMessage()).'</strong></p>' .
67
+            $body = "<p><strong>\n".htmlspecialchars($e->getMessage()).'</strong></p>'.
68 68
                     '<p>In '.htmlspecialchars($line)."</p><pre>\n".htmlspecialchars($e->getTraceAsString()).'</pre>';
69 69
         } else {
70 70
             $title = "PHPTAL Exception";
71
-            $body = "<p>This page cannot be displayed.</p><hr/>" .
71
+            $body = "<p>This page cannot be displayed.</p><hr/>".
72 72
                     "<p><small>Enable <code>display_errors</code> to see detailed message.</small></p>";
73 73
         }
74 74
 
Please login to merge, or discard this patch.
classes/PHPTAL/Keywords.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -21,6 +21,9 @@
 block discarded – undo
21 21
  */
22 22
 interface PHPTAL_Keywords extends Countable
23 23
 {
24
+    /**
25
+     * @return string
26
+     */
24 27
     public function __toString();
25 28
 }
26 29
 ?>
Please login to merge, or discard this patch.
classes/PHPTAL/NamespaceAttribute.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@
 block discarded – undo
71 71
     private $_namespace;
72 72
 
73 73
     /**
74
-     * @param string $name The attribute name
75 74
      * @param int $priority Attribute execution priority
75
+     * @param string $local_name
76 76
      */
77 77
     public function __construct($local_name, $priority)
78 78
     {
Please login to merge, or discard this patch.