Completed
Push — 1.2 ( 261ddf...fd7ca1 )
by David
15:45 queued 09:58
created
lib/Dwoo/Adapters/ZendFramework/PluginProxy.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
     /**
47 47
      * Dwoo_Adapters_ZendFramework_PluginProxy's constructor.
48 48
      *
49
-     * @param Zend_View_Interface $view
49
+     * @param Dwoo_Adapters_ZendFramework_View $view
50 50
      */
51 51
     public function __construct(Zend_View_Interface $view)
52 52
     {
Please login to merge, or discard this patch.
lib/Dwoo/Plugin.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,24 +79,24 @@
 block discarded – undo
79 79
 
80 80
         $out = '';
81 81
         foreach ($params as $attr => $val) {
82
-            $out .= ' ' . $attr . '=';
82
+            $out .= ' '.$attr.'=';
83 83
             if (trim($val, '"\'') == '' || $val == 'null') {
84
-                $out .= str_replace($delim, '\\' . $delim, '""');
84
+                $out .= str_replace($delim, '\\'.$delim, '""');
85 85
             } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
-                $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
86
+                $out .= str_replace($delim, '\\'.$delim, '"'.substr($val, 1, - 1).'"');
87 87
             } else {
88 88
                 if (!$compiler) {
89 89
                     // disable double encoding since it can not be determined if it was encoded
90
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
90
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91 91
                 } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92 92
                     // escape if auto escaping is disabled, or there was no variable in the string
93
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
93
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94 94
                 } else {
95 95
                     // print as is
96
-                    $escapedVal = '.' . $val . '.';
96
+                    $escapedVal = '.'.$val.'.';
97 97
                 }
98 98
 
99
-                $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
99
+                $out .= str_replace($delim, '\\'.$delim, '"').$delim.$escapedVal.$delim.str_replace($delim, '\\'.$delim, '"');
100 100
             }
101 101
         }
102 102
 
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/CodeIgniter/libraries/Dwootemplate.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
      * @param string $sTemplate
96 96
      * @param bool   $return
97 97
      *
98
-     * @return mixed
98
+     * @return null|string
99 99
      */
100 100
     public function display($sTemplate, $return = false)
101 101
     {
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/ZendFramework/View.php 1 patch
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,7 +87,6 @@  discard block
 block discarded – undo
87 87
      *  - type class name or object for engine, dataProvider or compiler
88 88
      *  - any set* method (compileDir for setCompileDir ...)
89 89
      *
90
-     * @param array $options
91 90
      *
92 91
      * @return Dwoo_Adapters_ZendFramework_View
93 92
      */
@@ -279,6 +278,7 @@  discard block
 block discarded – undo
279 278
      * Sets Dwoo data object.
280 279
      *
281 280
      * @param string|Dwoo_Data Object or name of the class
281
+     * @param Dwoo_Data $data
282 282
      */
283 283
     public function setDataProvider($data)
284 284
     {
@@ -441,7 +441,6 @@  discard block
 block discarded – undo
441 441
      * Processes a view script and outputs it. Output is then
442 442
      * passed through filters.
443 443
      *
444
-     * @param string $name The script script name to process
445 444
      *
446 445
      * @return string The script output
447 446
      */
Please login to merge, or discard this patch.
lib/Dwoo/Compiler.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     /**
275 275
      * returns the left and right template delimiters.
276 276
      *
277
-     * @return array containing the left and the right delimiters
277
+     * @return string[] containing the left and the right delimiters
278 278
      */
279 279
     public function getDelimiters()
280 280
     {
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
      * adds a preprocessor to the compiler, it will be called
367 367
      * before the template is compiled.
368 368
      *
369
-     * @param mixed $callback either a valid callback to the preprocessor or a simple name if the autoload is set to true
369
+     * @param string $callback either a valid callback to the preprocessor or a simple name if the autoload is set to true
370 370
      * @param bool  $autoload if set to true, the preprocessor is auto-loaded from one of the plugin directories, else you must provide a valid callback
371 371
      */
372 372
     public function addPreProcessor($callback, $autoload = false)
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
      *
1288 1288
      * @param array $params parameter array
1289 1289
      *
1290
-     * @return array tokens
1290
+     * @return Dwoo_Compiler tokens
1291 1291
      */
1292 1292
     public function getParamTokens(array $params)
1293 1293
     {
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -788,23 +788,23 @@  discard block
 block discarded – undo
788 788
             if ($pos === false) {
789 789
                 $this->push(substr($tpl, $ptr), 0);
790 790
                 break;
791
-            } elseif (substr($tpl, $pos - 1, 1) === '\\' && substr($tpl, $pos - 2, 1) !== '\\') {
792
-                $this->push(substr($tpl, $ptr, $pos - $ptr - 1).$this->ld);
793
-                $ptr = $pos + strlen($this->ld);
791
+            } elseif (substr($tpl, $pos-1, 1) === '\\' && substr($tpl, $pos-2, 1) !== '\\') {
792
+                $this->push(substr($tpl, $ptr, $pos-$ptr-1).$this->ld);
793
+                $ptr = $pos+strlen($this->ld);
794 794
             } elseif (preg_match('/^'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', substr($tpl, $pos), $litOpen)) {
795 795
                 if (!preg_match('/'.$this->ldr.($this->allowLooseOpenings ? '\s*' : '').'\/literal'.($this->allowLooseOpenings ? '\s*' : '').$this->rdr.'/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) {
796 796
                     throw new Dwoo_Compilation_Exception($this, 'The {literal} blocks must be closed explicitly with {/literal}');
797 797
                 }
798 798
                 $endpos = $litClose[0][1];
799
-                $this->push(substr($tpl, $ptr, $pos - $ptr).substr($tpl, $pos + strlen($litOpen[0]), $endpos - $pos - strlen($litOpen[0])));
800
-                $ptr = $endpos + strlen($litClose[0][0]);
799
+                $this->push(substr($tpl, $ptr, $pos-$ptr).substr($tpl, $pos+strlen($litOpen[0]), $endpos-$pos-strlen($litOpen[0])));
800
+                $ptr = $endpos+strlen($litClose[0][0]);
801 801
             } else {
802
-                if (substr($tpl, $pos - 2, 1) === '\\' && substr($tpl, $pos - 1, 1) === '\\') {
803
-                    $this->push(substr($tpl, $ptr, $pos - $ptr - 1));
802
+                if (substr($tpl, $pos-2, 1) === '\\' && substr($tpl, $pos-1, 1) === '\\') {
803
+                    $this->push(substr($tpl, $ptr, $pos-$ptr-1));
804 804
                     $ptr = $pos;
805 805
                 }
806 806
 
807
-                $this->push(substr($tpl, $ptr, $pos - $ptr));
807
+                $this->push(substr($tpl, $ptr, $pos-$ptr));
808 808
                 $ptr = $pos;
809 809
 
810 810
                 $pos += strlen($this->ld);
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
                         continue 2;
837 837
                     }
838 838
 
839
-                    $len = $subptr - $ptr;
839
+                    $len = $subptr-$ptr;
840 840
                     $this->push($parsed, substr_count(substr($tpl, $ptr, $len), "\n"));
841 841
                     $ptr += $len;
842 842
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
             $lines = preg_split('{\r\n|\n|<br />}', $output);
933 933
             array_shift($lines);
934 934
             foreach ($lines as $i => $line) {
935
-                echo($i + 1).'. '.$line."\r\n";
935
+                echo($i+1).'. '.$line."\r\n";
936 936
             }
937 937
             echo '============================================================================================='."\n";
938 938
         }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 
981 981
         if ($this->curBlock['buffer'] === null && count($this->stack) > 1) {
982 982
             // buffer is not initialized yet (the block has just been created)
983
-            $this->stack[count($this->stack) - 2]['buffer'] .= (string) $content;
983
+            $this->stack[count($this->stack)-2]['buffer'] .= (string) $content;
984 984
             $this->curBlock['buffer'] = '';
985 985
         } else {
986 986
             if (!isset($this->curBlock['buffer'])) {
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1069 1069
 
1070 1070
         $this->stack[] = array('type' => $type, 'params' => $params, 'custom' => false, 'class' => $class, 'buffer' => null);
1071
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1071
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1072 1072
 
1073 1073
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1074 1074
     }
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
         $params = $this->mapParams($params, array($class, 'init'), $paramtype);
1095 1095
 
1096 1096
         $this->stack[] = array('type' => $type, 'params' => $params, 'custom' => true, 'class' => $class, 'buffer' => null);
1097
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1097
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1098 1098
 
1099 1099
         return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type);
1100 1100
     }
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
             $this->dwoo->getLoader()->loadPlugin($type);
1119 1119
         }
1120 1120
         $this->stack[] = array('type' => $type, 'params' => $params, 'custom' => false, 'class' => $class, 'buffer' => null);
1121
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1121
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1122 1122
     }
1123 1123
 
1124 1124
     /**
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
                     $class = 'Dwoo_Plugin_'.$top['type'];
1152 1152
                 }
1153 1153
                 if (count($this->stack)) {
1154
-                    $this->curBlock = &$this->stack[count($this->stack) - 1];
1154
+                    $this->curBlock = &$this->stack[count($this->stack)-1];
1155 1155
                     $this->push(call_user_func(array($class, 'postProcessing'), $this, $top['params'], '', '', $top['buffer']), 0);
1156 1156
                 } else {
1157 1157
                     $null = null;
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
             $class = 'Dwoo_Plugin_'.$o['type'];
1242 1242
         }
1243 1243
 
1244
-        $this->curBlock = &$this->stack[count($this->stack) - 1];
1244
+        $this->curBlock = &$this->stack[count($this->stack)-1];
1245 1245
 
1246 1246
         return call_user_func(array($class, 'postProcessing'), $this, $o['params'], '', '', $o['buffer']);
1247 1247
     }
@@ -1353,16 +1353,16 @@  discard block
 block discarded – undo
1353 1353
             $first = $in[$from];
1354 1354
         }
1355 1355
 
1356
-        $substr = substr($in, $from, $to - $from);
1356
+        $substr = substr($in, $from, $to-$from);
1357 1357
 
1358 1358
         if ($this->debug) {
1359
-            echo 'PARSE CALL : PARSING "<b>'.htmlentities(substr($in, $from, min($to - $from, 50))).(($to - $from) > 50 ? '...' : '').'</b>" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1359
+            echo 'PARSE CALL : PARSING "<b>'.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').'</b>" @ '.$from.':'.$to.' in '.$curBlock.' : pointer='.$pointer."\n";
1360 1360
         }
1361 1361
         $parsed = '';
1362 1362
 
1363 1363
         if ($curBlock === 'root' && $first === '*') {
1364 1364
             $src = $this->getTemplateSource();
1365
-            $startpos = $this->getPointer() - strlen($this->ld);
1365
+            $startpos = $this->getPointer()-strlen($this->ld);
1366 1366
             if (substr($src, $startpos, strlen($this->ld)) === $this->ld) {
1367 1367
                 if ($startpos > 0) {
1368 1368
                     do {
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
                 if (!isset($whitespaceStart)) {
1379 1379
                     $startpos = $this->getPointer();
1380 1380
                 } else {
1381
-                    $pointer -= $this->getPointer() - $startpos;
1381
+                    $pointer -= $this->getPointer()-$startpos;
1382 1382
                 }
1383 1383
 
1384 1384
                 if ($this->allowNestedComments && strpos($src, $this->ld.'*', $this->getPointer()) !== false) {
@@ -1393,33 +1393,33 @@  discard block
 block discarded – undo
1393 1393
 
1394 1394
                         if ($open !== false && $close !== false) {
1395 1395
                             if ($open < $close) {
1396
-                                $ptr = $open + strlen($comOpen);
1396
+                                $ptr = $open+strlen($comOpen);
1397 1397
                                 ++$level;
1398 1398
                             } else {
1399
-                                $ptr = $close + strlen($comClose);
1399
+                                $ptr = $close+strlen($comClose);
1400 1400
                                 --$level;
1401 1401
                             }
1402 1402
                         } elseif ($open !== false) {
1403
-                            $ptr = $open + strlen($comOpen);
1403
+                            $ptr = $open+strlen($comOpen);
1404 1404
                             ++$level;
1405 1405
                         } elseif ($close !== false) {
1406
-                            $ptr = $close + strlen($comClose);
1406
+                            $ptr = $close+strlen($comClose);
1407 1407
                             --$level;
1408 1408
                         } else {
1409 1409
                             $ptr = strlen($src);
1410 1410
                         }
1411 1411
                     }
1412
-                    $endpos = $ptr - strlen('*'.$this->rd);
1412
+                    $endpos = $ptr-strlen('*'.$this->rd);
1413 1413
                 } else {
1414 1414
                     $endpos = strpos($src, '*'.$this->rd, $startpos);
1415 1415
                     if ($endpos == false) {
1416 1416
                         throw new Dwoo_Compilation_Exception($this, 'Un-ended comment');
1417 1417
                     }
1418 1418
                 }
1419
-                $pointer += $endpos - $startpos + strlen('*'.$this->rd);
1420
-                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos + strlen('*'.$this->rd)), $m)) {
1419
+                $pointer += $endpos-$startpos+strlen('*'.$this->rd);
1420
+                if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos+strlen('*'.$this->rd)), $m)) {
1421 1421
                     $pointer += strlen($m[0]);
1422
-                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer']) - ($this->getPointer() - $startpos - strlen($this->ld)));
1422
+                    $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer'])-($this->getPointer()-$startpos-strlen($this->ld)));
1423 1423
                 }
1424 1424
 
1425 1425
                 return false;
@@ -1449,7 +1449,7 @@  discard block
 block discarded – undo
1449 1449
                 ++$pointer;
1450 1450
             }
1451 1451
 
1452
-            return $this->parse($in, $from + 1, $to, false, 'root', $pointer);
1452
+            return $this->parse($in, $from+1, $to, false, 'root', $pointer);
1453 1453
         } elseif ($curBlock === 'root' && preg_match('#^/([a-z_][a-z0-9_]*)?#i', $substr, $match)) {
1454 1454
             // close block
1455 1455
             if (!empty($match[1]) && $match[1] == 'else') {
@@ -1491,14 +1491,14 @@  discard block
 block discarded – undo
1491 1491
                 echo 'NAMED PARAM FOUND'."\n";
1492 1492
             }
1493 1493
             $len = strlen($match[1]);
1494
-            while (substr($in, $from + $len, 1) === ' ') {
1494
+            while (substr($in, $from+$len, 1) === ' ') {
1495 1495
                 ++$len;
1496 1496
             }
1497 1497
             if ($pointer !== null) {
1498 1498
                 $pointer += $len;
1499 1499
             }
1500 1500
 
1501
-            $output = array(trim($match[1], " \t\r\n=>'\""), $this->parse($in, $from + $len, $to, false, 'namedparam', $pointer));
1501
+            $output = array(trim($match[1], " \t\r\n=>'\""), $this->parse($in, $from+$len, $to, false, 'namedparam', $pointer));
1502 1502
 
1503 1503
             $parsingParams[] = $output;
1504 1504
 
@@ -1518,14 +1518,14 @@  discard block
 block discarded – undo
1518 1518
             $out = $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1519 1519
         } else {
1520 1520
             // parse error
1521
-            throw new Dwoo_Compilation_Exception($this, 'Parse error in "'.substr($in, $from, $to - $from).'"');
1521
+            throw new Dwoo_Compilation_Exception($this, 'Parse error in "'.substr($in, $from, $to-$from).'"');
1522 1522
         }
1523 1523
 
1524 1524
         if (empty($out)) {
1525 1525
             return '';
1526 1526
         }
1527 1527
 
1528
-        $substr = substr($in, $pointer, $to - $pointer);
1528
+        $substr = substr($in, $pointer, $to-$pointer);
1529 1529
 
1530 1530
         // var parsed, check if any var-extension applies
1531 1531
         if ($parsed === 'var') {
@@ -1534,15 +1534,15 @@  discard block
 block discarded – undo
1534 1534
                     echo 'PARSING POST-VAR EXPRESSION '.$substr."\n";
1535 1535
                 }
1536 1536
                 // parse expressions
1537
-                $pointer += strlen($match[0]) - 1;
1537
+                $pointer += strlen($match[0])-1;
1538 1538
                 if (is_array($parsingParams)) {
1539 1539
                     if ($match[2] == '$') {
1540 1540
                         $expr = $this->parseVar($in, $pointer, $to, array(), $curBlock, $pointer);
1541 1541
                     } else {
1542 1542
                         $expr = $this->parse($in, $pointer, $to, array(), 'expression', $pointer);
1543 1543
                     }
1544
-                    $out[count($out) - 1][0] .= $match[1].$expr[0][0];
1545
-                    $out[count($out) - 1][1] .= $match[1].$expr[0][1];
1544
+                    $out[count($out)-1][0] .= $match[1].$expr[0][0];
1545
+                    $out[count($out)-1][1] .= $match[1].$expr[0][1];
1546 1546
                 } else {
1547 1547
                     if ($match[2] == '$') {
1548 1548
                         $expr = $this->parseVar($in, $pointer, $to, false, $curBlock, $pointer);
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
                     echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND'."\n";
1611 1611
                 }
1612 1612
                 $len = strlen($match[1]);
1613
-                $var = $out[count($out) - 1];
1613
+                $var = $out[count($out)-1];
1614 1614
                 $pointer += $len;
1615 1615
 
1616 1616
                 $output = array($var[0], $this->parse($substr, $len, null, false, 'namedparam', $pointer));
@@ -1625,9 +1625,9 @@  discard block
 block discarded – undo
1625 1625
             // parse modifier on funcs or vars
1626 1626
             $srcPointer = $pointer;
1627 1627
             if (is_array($parsingParams)) {
1628
-                $tmp = $this->replaceModifiers(array(null, null, $out[count($out) - 1][0], $match[0]), $curBlock, $pointer);
1629
-                $out[count($out) - 1][0] = $tmp;
1630
-                $out[count($out) - 1][1] .= substr($substr, $srcPointer, $srcPointer - $pointer);
1628
+                $tmp = $this->replaceModifiers(array(null, null, $out[count($out)-1][0], $match[0]), $curBlock, $pointer);
1629
+                $out[count($out)-1][0] = $tmp;
1630
+                $out[count($out)-1][1] .= substr($substr, $srcPointer, $srcPointer-$pointer);
1631 1631
             } else {
1632 1632
                 $out = $this->replaceModifiers(array(null, null, $out, $match[0]), $curBlock, $pointer);
1633 1633
             }
@@ -1639,10 +1639,10 @@  discard block
 block discarded – undo
1639 1639
             $ptr = 0;
1640 1640
 
1641 1641
             if (is_array($parsingParams)) {
1642
-                $output = $this->parseMethodCall($out[count($out) - 1][1], $match[0], $curBlock, $ptr);
1642
+                $output = $this->parseMethodCall($out[count($out)-1][1], $match[0], $curBlock, $ptr);
1643 1643
 
1644
-                $out[count($out) - 1][0] = $output;
1645
-                $out[count($out) - 1][1] .= substr($match[0], 0, $ptr);
1644
+                $out[count($out)-1][0] = $output;
1645
+                $out[count($out)-1][1] .= substr($match[0], 0, $ptr);
1646 1646
             } else {
1647 1647
                 $out = $this->parseMethodCall($out, $match[0], $curBlock, $ptr);
1648 1648
             }
@@ -1675,7 +1675,7 @@  discard block
 block discarded – undo
1675 1675
      */
1676 1676
     protected function parseFunction($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
1677 1677
     {
1678
-        $cmdstr = substr($in, $from, $to - $from);
1678
+        $cmdstr = substr($in, $from, $to-$from);
1679 1679
         preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*'.$this->rdr.'|\s*;)?/i', $cmdstr, $match);
1680 1680
 
1681 1681
         if (empty($match[1])) {
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
             $paramspos = $match[1][0][1];
1702 1702
             $paramsep = substr($match[1][0][0], -1) === '(' ? ')' : '';
1703 1703
             if ($paramsep === ')') {
1704
-                $paramspos += strlen($match[1][0][0]) - 1;
1704
+                $paramspos += strlen($match[1][0][0])-1;
1705 1705
                 if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') {
1706 1706
                     $paramsep = '';
1707 1707
                     if (strlen($match[1][0][0]) > 1) {
@@ -1730,8 +1730,8 @@  discard block
 block discarded – undo
1730 1730
                     return $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer);
1731 1731
                 }
1732 1732
             }
1733
-            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos - strlen($func)));
1734
-            $paramstr = substr($cmdstr, $paramspos + 1);
1733
+            $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos-strlen($func)));
1734
+            $paramstr = substr($cmdstr, $paramspos+1);
1735 1735
             if (substr($paramstr, -1, 1) === $paramsep) {
1736 1736
                 $paramstr = substr($paramstr, 0, -1);
1737 1737
             }
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
                         }
1795 1795
 
1796 1796
                         if ($this->debug) {
1797
-                            echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr - 1, 3).')'."\n";
1797
+                            echo 'PARAM PARSED, POINTER AT '.$ptr.' ('.substr($paramstr, $ptr-1, 3).')'."\n";
1798 1798
                         }
1799 1799
                     }
1800 1800
                 }
@@ -1818,9 +1818,9 @@  discard block
 block discarded – undo
1818 1818
         }
1819 1819
 
1820 1820
         if ($pointer !== null) {
1821
-            $pointer += (isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func) + (isset($whitespace) ? $whitespace : 0);
1821
+            $pointer += (isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)+(isset($whitespace) ? $whitespace : 0);
1822 1822
             if ($this->debug) {
1823
-                echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)).' TO POINTER'."\n";
1823
+                echo 'FUNC ADDS '.((isset($paramstr) ? strlen($paramstr) : 0)+(')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1))+strlen($func)).' TO POINTER'."\n";
1824 1824
             }
1825 1825
         }
1826 1826
 
@@ -2062,29 +2062,29 @@  discard block
 block discarded – undo
2062 2062
      */
2063 2063
     protected function parseString($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2064 2064
     {
2065
-        $substr = substr($in, $from, $to - $from);
2065
+        $substr = substr($in, $from, $to-$from);
2066 2066
         $first = $substr[0];
2067 2067
 
2068 2068
         if ($this->debug) {
2069
-            echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to - $from, 50))).(($to - $from) > 50 ? '...' : '').')'."\n";
2069
+            echo 'STRING FOUND (in '.htmlentities(substr($in, $from, min($to-$from, 50))).(($to-$from) > 50 ? '...' : '').')'."\n";
2070 2070
         }
2071 2071
         $strend = false;
2072
-        $o = $from + 1;
2072
+        $o = $from+1;
2073 2073
         while ($strend === false) {
2074 2074
             $strend = strpos($in, $first, $o);
2075 2075
             if ($strend === false) {
2076
-                throw new Dwoo_Compilation_Exception($this, 'Unfinished string, started with '.substr($in, $from, $to - $from));
2076
+                throw new Dwoo_Compilation_Exception($this, 'Unfinished string, started with '.substr($in, $from, $to-$from));
2077 2077
             }
2078
-            if (substr($in, $strend - 1, 1) === '\\') {
2079
-                $o = $strend + 1;
2078
+            if (substr($in, $strend-1, 1) === '\\') {
2079
+                $o = $strend+1;
2080 2080
                 $strend = false;
2081 2081
             }
2082 2082
         }
2083 2083
         if ($this->debug) {
2084
-            echo 'STRING DELIMITED: '.substr($in, $from, $strend + 1 - $from)."\n";
2084
+            echo 'STRING DELIMITED: '.substr($in, $from, $strend+1-$from)."\n";
2085 2085
         }
2086 2086
 
2087
-        $srcOutput = substr($in, $from, $strend + 1 - $from);
2087
+        $srcOutput = substr($in, $from, $strend+1-$from);
2088 2088
 
2089 2089
         if ($pointer !== null) {
2090 2090
             $pointer += strlen($srcOutput);
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
         $output = $this->replaceStringVars($srcOutput, $first);
2094 2094
 
2095 2095
         // handle modifiers
2096
-        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend + 1 - $from), $match)) {
2096
+        if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend+1-$from), $match)) {
2097 2097
             $modstr = $match[1];
2098 2098
 
2099 2099
             if ($curBlock === 'root' && substr($modstr, -1) === '}') {
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
             if ($pointer !== null) {
2108 2108
                 $pointer += $ptr;
2109 2109
             }
2110
-            $srcOutput .= substr($substr, $strend + 1 - $from, $ptr);
2110
+            $srcOutput .= substr($substr, $strend+1-$from, $ptr);
2111 2111
         }
2112 2112
 
2113 2113
         if (is_array($parsingParams)) {
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
      */
2138 2138
     protected function parseConst($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2139 2139
     {
2140
-        $substr = substr($in, $from, $to - $from);
2140
+        $substr = substr($in, $from, $to-$from);
2141 2141
 
2142 2142
         if ($this->debug) {
2143 2143
             echo 'CONST FOUND : '.$substr."\n";
@@ -2203,12 +2203,12 @@  discard block
 block discarded – undo
2203 2203
      */
2204 2204
     protected function parseVar($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2205 2205
     {
2206
-        $substr = substr($in, $from, $to - $from);
2206
+        $substr = substr($in, $from, $to-$from);
2207 2207
 
2208
-        if (preg_match('#(\$?\.?[a-z0-9_:]*(?:(?:(?:\.|->)(?:[a-z0-9_:]+|(?R))|\[(?:[a-z0-9_:]+|(?R)|(["\'])[^\2]*?\2)\]))*)'. // var key
2209
-            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'expression' || $curBlock === 'delimited_string' ? '(\(.*)?' : '()'). // method call
2210
-            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'delimited_string' ? '((?:(?:[+/*%=-])(?:(?<!=)=?-?[$%][a-z0-9.[\]>_:-]+(?:\([^)]*\))?|(?<!=)=?-?[0-9.,]*|[+-]))*)' : '()'). // simple math expressions
2211
-            ($curBlock !== 'modifier' ? '((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').*?\5|:[^`]*))*))+)?' : '(())'). // modifiers
2208
+        if (preg_match('#(\$?\.?[a-z0-9_:]*(?:(?:(?:\.|->)(?:[a-z0-9_:]+|(?R))|\[(?:[a-z0-9_:]+|(?R)|(["\'])[^\2]*?\2)\]))*)'.// var key
2209
+            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'expression' || $curBlock === 'delimited_string' ? '(\(.*)?' : '()').// method call
2210
+            ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'delimited_string' ? '((?:(?:[+/*%=-])(?:(?<!=)=?-?[$%][a-z0-9.[\]>_:-]+(?:\([^)]*\))?|(?<!=)=?-?[0-9.,]*|[+-]))*)' : '()').// simple math expressions
2211
+            ($curBlock !== 'modifier' ? '((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').*?\5|:[^`]*))*))+)?' : '(())').// modifiers
2212 2212
             '#i', $substr, $match)) {
2213 2213
             $key = substr($match[1], 1);
2214 2214
 
@@ -2223,8 +2223,8 @@  discard block
 block discarded – undo
2223 2223
             }
2224 2224
 
2225 2225
             if ($hasMethodCall) {
2226
-                $matchedLength -= strlen($match[3]) + strlen(substr($match[1], strrpos($match[1], '->')));
2227
-                $key = substr($match[1], 1, strrpos($match[1], '->') - 1);
2226
+                $matchedLength -= strlen($match[3])+strlen(substr($match[1], strrpos($match[1], '->')));
2227
+                $key = substr($match[1], 1, strrpos($match[1], '->')-1);
2228 2228
                 $methodCall = substr($match[1], strrpos($match[1], '->')).$match[3];
2229 2229
             }
2230 2230
 
@@ -2266,7 +2266,7 @@  discard block
 block discarded – undo
2266 2266
                             ++$bracketCount;
2267 2267
                         } else {
2268 2268
                             $tree[] = &$current;
2269
-                            $current[$uid] = array($uid + 1 => '');
2269
+                            $current[$uid] = array($uid+1 => '');
2270 2270
                             $current = &$current[$uid++];
2271 2271
                             $curTxt = &$current[$uid++];
2272 2272
                             continue;
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
                         if ($bracketCount > 0) {
2276 2276
                             --$bracketCount;
2277 2277
                         } else {
2278
-                            $current = &$tree[count($tree) - 1];
2278
+                            $current = &$tree[count($tree)-1];
2279 2279
                             array_pop($tree);
2280 2280
                             if (current($chars) !== '[' && current($chars) !== false && current($chars) !== ']') {
2281 2281
                                 $current[$uid] = '';
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
                 // method
2440 2440
                 if (substr($methMatch[2], 0, 2) === '()') {
2441 2441
                     $parsedCall = $methMatch[1].'()';
2442
-                    $ptr += strlen($methMatch[1]) + 2;
2442
+                    $ptr += strlen($methMatch[1])+2;
2443 2443
                 } else {
2444 2444
                     $parsedCall = $this->parseFunction($methodCall, $ptr, strlen($methodCall), false, 'method', $ptr);
2445 2445
                 }
@@ -2608,7 +2608,7 @@  discard block
 block discarded – undo
2608 2608
                     if ($cnt > 0) {
2609 2609
                         while (--$cnt >= 0) {
2610 2610
                             if (isset($last)) {
2611
-                                $last = strrpos($key, '$', -(strlen($key) - $last + 1));
2611
+                                $last = strrpos($key, '$', -(strlen($key)-$last+1));
2612 2612
                             } else {
2613 2613
                                 $last = strrpos($key, '$');
2614 2614
                             }
@@ -2673,7 +2673,7 @@  discard block
 block discarded – undo
2673 2673
     protected function parseOthers($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null)
2674 2674
     {
2675 2675
         $first = $in[$from];
2676
-        $substr = substr($in, $from, $to - $from);
2676
+        $substr = substr($in, $from, $to-$from);
2677 2677
 
2678 2678
         $end = strlen($substr);
2679 2679
 
@@ -2790,7 +2790,7 @@  discard block
 block discarded – undo
2790 2790
         }
2791 2791
         // replace vars
2792 2792
         while (($pos = strpos($string, '$', $pos)) !== false) {
2793
-            $prev = substr($string, $pos - 1, 1);
2793
+            $prev = substr($string, $pos-1, 1);
2794 2794
             if ($prev === '\\') {
2795 2795
                 ++$pos;
2796 2796
                 continue;
@@ -2800,12 +2800,12 @@  discard block
 block discarded – undo
2800 2800
             $len = $var[0];
2801 2801
             $var = $this->parse(str_replace('\\'.$first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string')));
2802 2802
 
2803
-            if ($prev === '`' && substr($string, $pos + $len, 1) === '`') {
2804
-                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos - 1, $len + 2);
2803
+            if ($prev === '`' && substr($string, $pos+$len, 1) === '`') {
2804
+                $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos-1, $len+2);
2805 2805
             } else {
2806 2806
                 $string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len);
2807 2807
             }
2808
-            $pos += strlen($var[1]) + 2;
2808
+            $pos += strlen($var[1])+2;
2809 2809
             if ($this->debug) {
2810 2810
                 echo 'STRING VAR REPLACEMENT DONE : '.$string."\n";
2811 2811
             }
@@ -2886,7 +2886,7 @@  discard block
 block discarded – undo
2886 2886
                     echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS'."\n";
2887 2887
                 }
2888 2888
             } else {
2889
-                $paramstr = substr($cmdstr, $paramspos + 1);
2889
+                $paramstr = substr($cmdstr, $paramspos+1);
2890 2890
                 if (substr($paramstr, -1, 1) === $paramsep) {
2891 2891
                     $paramstr = substr($paramstr, 0, -1);
2892 2892
                 }
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
                         if ($paramstr[$ptr] !== '|') {
2920 2920
                             $continue = false;
2921 2921
                             if ($pointer !== null) {
2922
-                                $pointer -= strlen($paramstr) - $ptr;
2922
+                                $pointer -= strlen($paramstr)-$ptr;
2923 2923
                             }
2924 2924
                         }
2925 2925
                         ++$ptr;
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
                         ++$ptr;
2930 2930
                     }
2931 2931
                 }
2932
-                $cmdstrsrc = substr($cmdstrsrc, strlen($func) + 1 + $ptr);
2932
+                $cmdstrsrc = substr($cmdstrsrc, strlen($func)+1+$ptr);
2933 2933
                 $paramstr = substr($paramstr, 0, $ptr);
2934 2934
                 foreach ($params as $k => $p) {
2935 2935
                     if (is_array($p) && is_array($p[1])) {
Please login to merge, or discard this patch.
lib/Dwoo/Data.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,6 @@
 block discarded – undo
70 70
      * merges the given array(s) with the current data with array_merge.
71 71
      *
72 72
      * @param array $data  the array to merge
73
-     * @param array $data2 $data3 ... other arrays to merge, optional, etc
74 73
      */
75 74
     public function mergeData(array $data)
76 75
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 }
144 144
 
145 145
                 if ($merge === true && is_array($val)) {
146
-                    $this->data[$key] = $val + $this->data[$key];
146
+                    $this->data[$key] = $val+$this->data[$key];
147 147
                 } else {
148 148
                     $this->data[$key][] = $val;
149 149
                 }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             }
157 157
 
158 158
             if ($merge === true && is_array($val)) {
159
-                $this->data[$name] = $val + $this->data[$name];
159
+                $this->data[$name] = $val+$this->data[$name];
160 160
             } else {
161 161
                 $this->data[$name][] = $val;
162 162
             }
Please login to merge, or discard this patch.
lib/Dwoo/ICompiler.php 1 patch
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * compiles the provided string down to php code.
29 29
      *
30
-     * @param string $templateStr the template to compile
30
+     * @param string $template the template to compile
31 31
      *
32 32
      * @return string a compiled php code string
33 33
      */
@@ -39,6 +39,7 @@  discard block
 block discarded – undo
39 39
      * @see Dwoo_Core::addPlugin
40 40
      *
41 41
      * @param array $customPlugins an array of custom plugins
42
+     * @return void
42 43
      */
43 44
     public function setCustomPlugins(array $customPlugins);
44 45
 
@@ -49,6 +50,7 @@  discard block
 block discarded – undo
49 50
      * set it on the Dwoo object as it will be passed onto the compiler automatically
50 51
      *
51 52
      * @param Dwoo_Security_Policy $policy the security policy object
53
+     * @return void
52 54
      */
53 55
     public function setSecurityPolicy(Dwoo_Security_Policy $policy = null);
54 56
 }
Please login to merge, or discard this patch.
lib/Dwoo/Loader.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@
 block discarded – undo
47 47
 
48 48
     protected $corePluginDir;
49 49
 
50
+    /**
51
+     * @param string $cacheDir
52
+     */
50 53
     public function __construct($cacheDir)
51 54
     {
52 55
         $this->corePluginDir = DWOO_DIRECTORY.'plugins';
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $cacheFile = $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php';
57 57
         if (file_exists($cacheFile)) {
58 58
             $classpath = file_get_contents($cacheFile);
59
-            $this->classPath = unserialize($classpath) + $this->classPath;
59
+            $this->classPath = unserialize($classpath)+$this->classPath;
60 60
         } else {
61 61
             $this->rebuildClassPathCache($this->corePluginDir, $cacheFile);
62 62
         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $this->paths[$pluginDir] = $cacheFile;
154 154
         if (file_exists($cacheFile)) {
155 155
             $classpath = file_get_contents($cacheFile);
156
-            $this->classPath = unserialize($classpath) + $this->classPath;
156
+            $this->classPath = unserialize($classpath)+$this->classPath;
157 157
         } else {
158 158
             $this->rebuildClassPathCache($pluginDir, $cacheFile);
159 159
         }
Please login to merge, or discard this patch.
lib/Dwoo/Template/String.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -286,7 +286,7 @@
 block discarded – undo
286 286
      * @param Dwoo_Core $dwoo   the dwoo instance that requests it
287 287
      * @param string    $output the template output
288 288
      *
289
-     * @return mixed full path of the cached file or false upon failure
289
+     * @return false|string full path of the cached file or false upon failure
290 290
      */
291 291
     public function cache(Dwoo_Core $dwoo, $output)
292 292
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) {
270 270
             // already checked, return cache file
271 271
             return $cachedFile;
272
-        } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME'] - $cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) {
272
+        } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME']-$cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) {
273 273
             // cache is still valid and can be loaded
274 274
             self::$cache['cached'][$this->cacheId] = true;
275 275
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     {
336 336
         $cachedFile = $this->getCacheFilename($dwoo);
337 337
 
338
-        return !file_exists($cachedFile) || (filectime($cachedFile) < (time() - $olderThan) && unlink($cachedFile));
338
+        return !file_exists($cachedFile) || (filectime($cachedFile) < (time()-$olderThan) && unlink($cachedFile));
339 339
     }
340 340
 
341 341
     /**
Please login to merge, or discard this patch.