Completed
Branch 1.3.x (b833d8)
by Ben
05:10
created
classes/PHPTAL/Tales.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  * @see PHPTAL_Php_TalesInternal::compileToPHPExpressions()
37 37
  * @return string
38 38
  */
39
-function phptal_tale($expression, $nothrow=false)
39
+function phptal_tale($expression, $nothrow = false)
40 40
 {
41 41
     return PHPTAL_Php_TalesInternal::compileToPHPExpression($expression, $nothrow);
42 42
 }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
  * @param bool $nothrow if true, invalid expression will return NULL (at run time) rather than throwing exception
52 52
  * @return string or array
53 53
  */
54
-function phptal_tales($expression, $nothrow=false)
54
+function phptal_tales($expression, $nothrow = false)
55 55
 {
56 56
     return PHPTAL_Php_TalesInternal::compileToPHPExpressions($expression, $nothrow);
57 57
 }
Please login to merge, or discard this patch.
classes/PHPTAL/TranslationService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,5 +58,5 @@
 block discarded – undo
58 58
      * @param string $key - translation key, e.g. "hello ${username}!"
59 59
      * @param string $htmlescape - if true, you should HTML-escape translated string. You should never HTML-escape interpolated variables.
60 60
      */
61
-    function translate($key, $htmlescape=true);
61
+    function translate($key, $htmlescape = true);
62 62
 }
Please login to merge, or discard this patch.
classes/PHPTAL/FileSourceResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     public function resolve($path)
30 30
     {
31 31
         foreach ($this->_repositories as $repository) {
32
-            $file = $repository . DIRECTORY_SEPARATOR . $path;
32
+            $file = $repository.DIRECTORY_SEPARATOR.$path;
33 33
             if (file_exists($file)) {
34 34
                 return new PHPTAL_FileSource($file);
35 35
             }
Please login to merge, or discard this patch.
classes/PHPTAL/ExceptionHandler.php 1 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/TemplateException.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public $srcLine;
27 27
     private $is_src_accurate;
28 28
 
29
-    public function __construct($msg, $srcFile='', $srcLine=0)
29
+    public function __construct($msg, $srcFile = '', $srcLine = 0)
30 30
     {
31 31
         parent::__construct($msg);
32 32
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         if ($this->is_src_accurate) {
42 42
             $this->file = $this->srcFile;
43
-            $this->line = (int)$this->srcLine;
43
+            $this->line = (int) $this->srcLine;
44 44
         }
45 45
     }
46 46
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         if ($this->is_src_accurate) {
69 69
             $this->file = $this->srcFile;
70
-            $this->line = (int)$this->srcLine;
70
+            $this->line = (int) $this->srcLine;
71 71
         }
72 72
     }
73 73
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
         $eval_path = NULL;
87 87
 
88 88
         // searches backtrace to find template file
89
-        foreach($this->getTrace() as $tr) {
90
-            if (!isset($tr['file'],$tr['line'])) continue;
89
+        foreach ($this->getTrace() as $tr) {
90
+            if (!isset($tr['file'], $tr['line'])) continue;
91 91
 
92 92
             if ($this->isTemplatePath($tr['file'])) {
93 93
                 return array($tr['file'], $tr['line']);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
             if (false !== strpos($tr['file'], 'eval()')) {
99 99
                 $eval_line = $tr['line'];
100 100
             }
101
-            else if ($eval_line && isset($tr['function'],$tr['args'],$tr['args'][0]) &&
101
+            else if ($eval_line && isset($tr['function'], $tr['args'], $tr['args'][0]) &&
102 102
                 $this->isTemplatePath("/".$tr['function'].".php") && $tr['args'][0] instanceof PHPTAL) {
103 103
                 return array($tr['args'][0]->getCodePath(), $eval_line);
104 104
             }
105 105
         }
106 106
 
107
-        return array(NULL,NULL);
107
+        return array(NULL, NULL);
108 108
     }
109 109
 
110 110
     /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         $this->srcFile = $this->file;
120 120
         $this->srcLine = $this->line;
121 121
 
122
-        list($file,$line) = $this->findFileAndLine();
122
+        list($file, $line) = $this->findFileAndLine();
123 123
 
124 124
         if (NULL === $file) {
125 125
             return false;
@@ -134,23 +134,23 @@  discard block
 block discarded – undo
134 134
             return false;
135 135
         }
136 136
 
137
-        $found_line=false;
138
-        $found_file=false;
137
+        $found_line = false;
138
+        $found_file = false;
139 139
 
140 140
         // scan lines backwards looking for "from line" comments
141 141
         $end = min(count($lines), $line)-1;
142
-        for($i=$end; $i >= 0; $i--) {
142
+        for ($i = $end; $i >= 0; $i--) {
143 143
             if (preg_match('/tag "[^"]*" from line (\d+)/', $lines[$i], $m)) {
144 144
                 $this->srcLine = intval($m[1]);
145
-                $found_line=true;
145
+                $found_line = true;
146 146
                 break;
147 147
             }
148 148
         }
149 149
 
150
-        foreach(preg_grep('/Generated by PHPTAL from/',$lines) as $line) {
150
+        foreach (preg_grep('/Generated by PHPTAL from/', $lines) as $line) {
151 151
             if (preg_match('/Generated by PHPTAL from (.*) \(/', $line, $m)) {
152 152
                 $this->srcFile = $m[1];
153
-                $found_file=true;
153
+                $found_file = true;
154 154
                 break;
155 155
             }
156 156
         }
Please login to merge, or discard this patch.
classes/PHPTAL/Dom/Element.php 1 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/XmlnsState.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
                 $prefix_to_uri[$prefix] = $value;
77 77
             }
78 78
 
79
-            if ($qname == 'xmlns') {$changed=true;$current_default = $value;}
79
+            if ($qname == 'xmlns') {$changed = true; $current_default = $value; }
80 80
         }
81 81
 
82 82
         if ($changed) {
Please login to merge, or discard this patch.
classes/PHPTAL/Dom/DocumentBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  */
22 22
 abstract class PHPTAL_Dom_DocumentBuilder
23 23
 {
24
-    protected $_stack;   /* array<PHPTAL_Dom_Node> */
24
+    protected $_stack; /* array<PHPTAL_Dom_Node> */
25 25
     protected $_current; /* PHPTAL_Dom_Node */
26 26
 
27 27
     protected $file, $line;
Please login to merge, or discard this patch.
classes/PHPTAL/Dom/PHPTALDocumentBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class PHPTAL_Dom_PHPTALDocumentBuilder extends PHPTAL_Dom_DocumentBuilder
24 24
 {
25
-    private $_xmlns;   /* PHPTAL_Dom_XmlnsState */
25
+    private $_xmlns; /* PHPTAL_Dom_XmlnsState */
26 26
     private $encoding;
27 27
 
28 28
     public function __construct()
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     public function onDocumentEnd()
53 53
     {
54 54
         if (count($this->_stack) > 0) {
55
-            $left='</'.$this->_current->getQualifiedName().'>';
56
-            for ($i = count($this->_stack)-1; $i>0; $i--) $left .= '</'.$this->_stack[$i]->getQualifiedName().'>';
55
+            $left = '</'.$this->_current->getQualifiedName().'>';
56
+            for ($i = count($this->_stack)-1; $i > 0; $i--) $left .= '</'.$this->_stack[$i]->getQualifiedName().'>';
57 57
             throw new PHPTAL_ParserException("Not all elements were closed before end of the document. Missing: ".$left,
58 58
                         $this->file, $this->line);
59 59
         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
         $node = new PHPTAL_Dom_Element($element_qname, $namespace_uri, $attrnodes, $this->getXmlnsState());
131 131
         $this->pushNode($node);
132
-        $this->_stack[] =  $this->_current;
132
+        $this->_stack[] = $this->_current;
133 133
         $this->_current = $node;
134 134
     }
135 135
 
Please login to merge, or discard this patch.