Completed
Pull Request — master (#87)
by David
14:35 queued 07:46
created
lib/Dwoo/Plugins/Helpers/PluginArray.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,11 +46,11 @@
 block discarded – undo
46 46
         $out = array();
47 47
         foreach ($rest as $key => $value) {
48 48
             if (!is_numeric($key) && !strstr($key, '$this->scope')) {
49
-                $key = "'" . $key . "'";
49
+                $key = "'".$key."'";
50 50
             }
51
-            $out[] = $key . '=>' . $value;
51
+            $out[] = $key.'=>'.$value;
52 52
         }
53 53
 
54
-        return 'array(' . implode(', ', $out) . ')';
54
+        return 'array('.implode(', ', $out).')';
55 55
     }
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Data.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         if (is_array($name)) {
99 99
             reset($name);
100
-            foreach ($name as $k => $v){
100
+            foreach ($name as $k => $v) {
101 101
                 $this->data[$k] = $v;
102 102
             }
103 103
         } else {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
                 }
147 147
 
148 148
                 if ($merge === true && is_array($val)) {
149
-                    $this->data[$key] = $val + $this->data[$key];
149
+                    $this->data[$key] = $val+$this->data[$key];
150 150
                 } else {
151 151
                     $this->data[$key][] = $val;
152 152
                 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             }
160 160
 
161 161
             if ($merge === true && is_array($val)) {
162
-                $this->data[$name] = $val + $this->data[$name];
162
+                $this->data[$name] = $val+$this->data[$name];
163 163
             } else {
164 164
                 $this->data[$name][] = $val;
165 165
             }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         if (isset($this->data[$name])) {
259 259
             return $this->data[$name];
260 260
         } else {
261
-            throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"');
261
+            throw new Exception('Tried to read a value that was not assigned yet : "'.$name.'"');
262 262
         }
263 263
     }
264 264
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginDump.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         $out .= $this->export($var, $scope);
72 72
 
73
-        return $out . '</div></div>';
73
+        return $out.'</div></div>';
74 74
     }
75 75
 
76 76
     /**
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
         $out = '';
85 85
         foreach ($var as $i => $v) {
86 86
             if (is_array($v) || (is_object($v) && $v instanceof Iterator)) {
87
-                $out .= $i . ' (' . (is_array($v) ? 'array' : 'object: ' . get_class($v)) . ')';
87
+                $out .= $i.' ('.(is_array($v) ? 'array' : 'object: '.get_class($v)).')';
88 88
                 if ($v === $scope) {
89
-                    $out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">' . $this->export($v, $scope) . '</div>';
89
+                    $out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">'.$this->export($v, $scope).'</div>';
90 90
                 } else {
91
-                    $out .= ':<div style="padding-left:20px;">' . $this->export($v, $scope) . '</div>';
91
+                    $out .= ':<div style="padding-left:20px;">'.$this->export($v, $scope).'</div>';
92 92
                 }
93 93
             } elseif (is_object($v)) {
94
-                $out .= $this->exportObj($i . ' (object: ' . get_class($v) . '):', $v);
94
+                $out .= $this->exportObj($i.' (object: '.get_class($v).'):', $v);
95 95
             } else {
96
-                $out .= $this->exportVar($i . ' = ', $v);
96
+                $out .= $this->exportVar($i.' = ', $v);
97 97
             }
98 98
         }
99 99
 
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
     protected function exportVar($i, $v)
110 110
     {
111 111
         if (is_string($v) || is_bool($v) || is_numeric($v)) {
112
-            return $i . htmlentities(var_export($v, true)) . '<br />';
112
+            return $i.htmlentities(var_export($v, true)).'<br />';
113 113
         } elseif (is_null($v)) {
114
-            return $i . 'null<br />';
114
+            return $i.'null<br />';
115 115
         } elseif (is_resource($v)) {
116
-            return $i . 'resource(' . get_resource_type($v) . ')<br />';
116
+            return $i.'resource('.get_resource_type($v).')<br />';
117 117
         } else {
118
-            return $i . htmlentities(var_export($v, true)) . '<br />';
118
+            return $i.htmlentities(var_export($v, true)).'<br />';
119 119
         }
120 120
     }
121 121
 
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
     protected function exportObj($i, $obj)
129 129
     {
130 130
         if (array_search($obj, $this->outputObjects, true) !== false) {
131
-            return $i . ' [recursion, skipped]<br />';
131
+            return $i.' [recursion, skipped]<br />';
132 132
         }
133 133
 
134 134
         $this->outputObjects[] = $obj;
135 135
 
136
-        $list = (array)$obj;
136
+        $list = (array) $obj;
137 137
 
138
-        $protectedLength = strlen(get_class($obj)) + 2;
138
+        $protectedLength = strlen(get_class($obj))+2;
139 139
 
140 140
         $out = array();
141 141
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 
154 154
                 $params = array();
155 155
                 foreach ($method->getParameters() as $param) {
156
-                    $params[] = ($param->isPassedByReference() ? '&' : '') . '$' . $param->getName() . ($param->isOptional() ? ' = ' . var_export($param->getDefaultValue(), true) : '');
156
+                    $params[] = ($param->isPassedByReference() ? '&' : '').'$'.$param->getName().($param->isOptional() ? ' = '.var_export($param->getDefaultValue(), true) : '');
157 157
                 }
158 158
 
159
-                $out['method'] .= '(method) ' . $method->getName() . '(' . implode(', ', $params) . ')<br />';
159
+                $out['method'] .= '(method) '.$method->getName().'('.implode(', ', $params).')<br />';
160 160
             }
161 161
         }
162 162
 
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
                 $out[$key] = '';
176 176
             }
177 177
 
178
-            $out[$key] .= '(' . $key . ') ';
178
+            $out[$key] .= '('.$key.') ';
179 179
 
180 180
             if (is_array($attributeValue)) {
181
-                $out[$key] .= $attributeName . ' (array):<br />
182
-							<div style="padding-left:20px;">' . $this->export($attributeValue, false) . '</div>';
181
+                $out[$key] .= $attributeName.' (array):<br />
182
+							<div style="padding-left:20px;">' . $this->export($attributeValue, false).'</div>';
183 183
             } elseif (is_object($attributeValue)) {
184
-                $out[$key] .= $this->exportObj($attributeName . ' (object: ' . get_class($attributeValue) . '):', $attributeValue);
184
+                $out[$key] .= $this->exportObj($attributeName.' (object: '.get_class($attributeValue).'):', $attributeValue);
185 185
             } else {
186
-                $out[$key] .= $this->exportVar($attributeName . ' = ', $attributeValue);
186
+                $out[$key] .= $this->exportVar($attributeName.' = ', $attributeValue);
187 187
             }
188 188
         }
189 189
 
190
-        $return = $i . '<br /><div style="padding-left:20px;">';
190
+        $return = $i.'<br /><div style="padding-left:20px;">';
191 191
 
192 192
         if (!empty($out['method'])) {
193 193
             $return .= $out['method'];
@@ -205,6 +205,6 @@  discard block
 block discarded – undo
205 205
             $return .= $out['private'];
206 206
         }
207 207
 
208
-        return $return . '</div>';
208
+        return $return.'</div>';
209 209
     }
210 210
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCapitalize.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@
 block discarded – undo
38 38
     public function process($value, $numwords = false)
39 39
     {
40 40
         if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
41
-            return mb_convert_case((string)$value, MB_CASE_TITLE, $this->core->getCharset());
41
+            return mb_convert_case((string) $value, MB_CASE_TITLE, $this->core->getCharset());
42 42
         } else {
43
-            $bits = explode(' ', (string)$value);
43
+            $bits = explode(' ', (string) $value);
44 44
             $out  = '';
45
-            foreach ($bits as $k => $v){
45
+            foreach ($bits as $k => $v) {
46 46
                 if (preg_match('#^[^0-9]+$#', $v)) {
47
-                    $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
47
+                    $out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
48 48
                 } else {
49
-                    $out .= ' ' . $v;
49
+                    $out .= ' '.$v;
50 50
                 }
51 51
             }
52 52
 
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Blocks/PluginWithelse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         }
67 67
 
68 68
         $block                      = &$compiler->getCurrentBlock();
69
-        $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE;
69
+        $block['params']['hasElse'] = Compiler::PHP_OPEN."else {\n".Compiler::PHP_CLOSE.$content.Compiler::PHP_OPEN."\n}".Compiler::PHP_CLOSE;
70 70
 
71 71
         return '';
72 72
     }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Blocks/PluginElse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         }
67 67
 
68 68
         $block                      = &$compiler->getCurrentBlock();
69
-        $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE;
69
+        $block['params']['hasElse'] = Compiler::PHP_OPEN."else {\n".Compiler::PHP_CLOSE.$content.Compiler::PHP_OPEN."\n}".Compiler::PHP_CLOSE;
70 70
 
71 71
         return '';
72 72
     }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Blocks/PluginForelse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         }
67 67
 
68 68
         $block                      = &$compiler->getCurrentBlock();
69
-        $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE;
69
+        $block['params']['hasElse'] = Compiler::PHP_OPEN."else {\n".Compiler::PHP_CLOSE.$content.Compiler::PHP_OPEN."\n}".Compiler::PHP_CLOSE;
70 70
 
71 71
         return '';
72 72
     }
Please login to merge, or discard this patch.
lib/Dwoo/Template/Str.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
         $this->cacheTime = $cacheTime;
125 125
 
126 126
         if ($compileId !== null) {
127
-            $this->compileId = str_replace('../', '__', strtr($compileId, '\\%?=!:;' . PATH_SEPARATOR, '/-------'));
127
+            $this->compileId = str_replace('../', '__', strtr($compileId, '\\%?=!:;'.PATH_SEPARATOR, '/-------'));
128 128
         } else {
129 129
             $this->compileId = $templateString;
130 130
         }
131 131
 
132 132
         if ($cacheId !== null) {
133
-            $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------'));
133
+            $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------'));
134 134
         }
135 135
     }
136 136
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) {
278 278
             // already checked, return cache file
279 279
             return $cachedFile;
280
-        } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === - 1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME'] - $cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($core))) {
280
+        } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === - 1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME']-$cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($core))) {
281 281
             // cache is still valid and can be loaded
282 282
             self::$cache['cached'][$this->cacheId] = true;
283 283
 
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
         // thanks for his help on avoiding concurency issues
306 306
         $temp = tempnam($cacheDir, 'temp');
307 307
         if (!($file = @fopen($temp, 'wb'))) {
308
-            $temp = $cacheDir . uniqid('temp');
308
+            $temp = $cacheDir.uniqid('temp');
309 309
             if (!($file = @fopen($temp, 'wb'))) {
310
-                trigger_error('Error writing temporary file \'' . $temp . '\'', E_USER_WARNING);
310
+                trigger_error('Error writing temporary file \''.$temp.'\'', E_USER_WARNING);
311 311
 
312 312
                 return false;
313 313
             }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
     {
344 344
         $cachedFile = $this->getCacheFilename($core);
345 345
 
346
-        return !file_exists($cachedFile) || (filectime($cachedFile) < (time() - $olderThan) && unlink($cachedFile));
346
+        return !file_exists($cachedFile) || (filectime($cachedFile) < (time()-$olderThan) && unlink($cachedFile));
347 347
     }
348 348
 
349 349
     /**
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      */
447 447
     protected function getCompiledFilename(Core $core)
448 448
     {
449
-        return $core->getCompileDir() . hash('md4', $this->compileId) . '.d' . Core::RELEASE_TAG . '.php';
449
+        return $core->getCompileDir().hash('md4', $this->compileId).'.d'.Core::RELEASE_TAG.'.php';
450 450
     }
451 451
 
452 452
     /**
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
             if (isset($_SERVER['REQUEST_URI']) === true) {
465 465
                 $cacheId = $_SERVER['REQUEST_URI'];
466 466
             } elseif (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['argv'])) {
467
-                $cacheId = $_SERVER['SCRIPT_FILENAME'] . '-' . implode('-', $_SERVER['argv']);
467
+                $cacheId = $_SERVER['SCRIPT_FILENAME'].'-'.implode('-', $_SERVER['argv']);
468 468
             } else {
469 469
                 $cacheId = '';
470 470
             }
@@ -472,10 +472,10 @@  discard block
 block discarded – undo
472 472
             $this->getCompiledFilename($core);
473 473
 
474 474
             $this->cacheId = str_replace('../', '__',
475
-                $this->compileId . strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------'));
475
+                $this->compileId.strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------'));
476 476
         }
477 477
 
478
-        return $core->getCacheDir() . $this->cacheId . '.html';
478
+        return $core->getCacheDir().$this->cacheId.'.html';
479 479
     }
480 480
 
481 481
     /**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
         }
513 513
 
514 514
         $retries = 3;
515
-        while ($retries --) {
515
+        while ($retries--) {
516 516
             @mkdir($path, $chmod, true);
517 517
             if (is_dir($path)) {
518 518
                 break;
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
             $path    = strtr(str_replace($baseDir, '', $path), '\\', '/');
526 526
             $folders = explode('/', trim($path, '/'));
527 527
             foreach ($folders as $folder) {
528
-                $baseDir .= $folder . DIRECTORY_SEPARATOR;
528
+                $baseDir .= $folder.DIRECTORY_SEPARATOR;
529 529
                 if (!chmod($baseDir, $chmod)) {
530
-                    throw new Exception('Unable to chmod ' . "$baseDir to $chmod: " . print_r(error_get_last(), true));
530
+                    throw new Exception('Unable to chmod '."$baseDir to $chmod: ".print_r(error_get_last(), true));
531 531
                 }
532 532
             }
533 533
         }
Please login to merge, or discard this patch.
lib/Dwoo/Template/File.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     protected function isValidCompiledFile($file)
113 113
     {
114
-        return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file);
114
+        return parent::isValidCompiledFile($file) && (int) $this->getUid() <= filemtime($file);
115 115
     }
116 116
 
117 117
     /**
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
         } else {
150 150
             foreach ($this->getIncludePath() as $path) {
151 151
                 $path = rtrim($path, DIRECTORY_SEPARATOR);
152
-                if (file_exists($path . DIRECTORY_SEPARATOR . $this->file) === true) {
153
-                    return $this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file;
152
+                if (file_exists($path.DIRECTORY_SEPARATOR.$this->file) === true) {
153
+                    return $this->resolvedPath = $path.DIRECTORY_SEPARATOR.$this->file;
154 154
                 }
155 155
             }
156 156
 
157
-            throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)');
157
+            throw new DwooException('Template "'.$this->file.'" could not be found in any of your include path(s)');
158 158
         }
159 159
     }
160 160
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function getUid()
168 168
     {
169
-        return (string)filemtime($this->getResourceIdentifier());
169
+        return (string) filemtime($this->getResourceIdentifier());
170 170
     }
171 171
 
172 172
     /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                         throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)');
225 225
                     }
226 226
                 } else {
227
-                    $resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId;
227
+                    $resourceId = dirname($parentTemplate->getResourceIdentifier()).DIRECTORY_SEPARATOR.$resourceId;
228 228
                     if (file_exists($resourceId) === false) {
229 229
                         return null;
230 230
                     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         if ($policy = $core->getSecurityPolicy()) {
238 238
             while (true) {
239 239
                 if (preg_match('{^([a-z]+?)://}i', $resourceId)) {
240
-                    throw new SecurityException('The security policy prevents you to read files from external sources : <em>' . $resourceId . '</em>.');
240
+                    throw new SecurityException('The security policy prevents you to read files from external sources : <em>'.$resourceId.'</em>.');
241 241
                 }
242 242
 
243 243
                 if ($includePath) {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                         break 2;
252 252
                     }
253 253
                 }
254
-                throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>');
254
+                throw new SecurityException('The security policy prevents you to read <em>'.$resourceId.'</em>');
255 255
             }
256 256
         }
257 257
 
@@ -271,6 +271,6 @@  discard block
 block discarded – undo
271 271
      */
272 272
     public function getIsModifiedCode()
273 273
     {
274
-        return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')';
274
+        return '"'.$this->getUid().'" == filemtime('.var_export($this->getResourceIdentifier(), true).')';
275 275
     }
276 276
 }
Please login to merge, or discard this patch.