Completed
Pull Request — master (#54)
by
unknown
18:56
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/Context.php 1 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/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.