Passed
Pull Request — master (#62)
by David
09:16
created
lib/Dwoo/Plugins/Helpers/PluginArray.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -35,22 +35,22 @@
 block discarded – undo
35 35
  */
36 36
 class PluginArray extends Plugin implements ICompilable
37 37
 {
38
-    /**
39
-     * @param Compiler $compiler
40
-     * @param array    $rest
41
-     *
42
-     * @return string
43
-     */
44
-    public static function compile(Compiler $compiler, array $rest = array())
45
-    {
46
-        $out = array();
47
-        foreach ($rest as $key => $value) {
48
-            if (!is_numeric($key) && !strstr($key, '$this->scope')) {
49
-                $key = "'" . $key . "'";
50
-            }
51
-            $out[] = $key . '=>' . $value;
52
-        }
38
+	/**
39
+	 * @param Compiler $compiler
40
+	 * @param array    $rest
41
+	 *
42
+	 * @return string
43
+	 */
44
+	public static function compile(Compiler $compiler, array $rest = array())
45
+	{
46
+		$out = array();
47
+		foreach ($rest as $key => $value) {
48
+			if (!is_numeric($key) && !strstr($key, '$this->scope')) {
49
+				$key = "'" . $key . "'";
50
+			}
51
+			$out[] = $key . '=>' . $value;
52
+		}
53 53
 
54
-        return 'array(' . implode(', ', $out) . ')';
55
-    }
54
+		return 'array(' . implode(', ', $out) . ')';
55
+	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this 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/Template/File.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 
19 19
 use Dwoo\Exception as DwooException;
20 20
 use Dwoo\Core as Core;
21
-use Dwoo\ICompiler;
22 21
 use Dwoo\ITemplate as ITemplate;
23 22
 use Dwoo\Security\Exception as SecurityException;
24 23
 use Dwoo\Template\File as TemplateFile;
Please login to merge, or discard this patch.
Indentation   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -30,264 +30,264 @@
 block discarded – undo
30 30
  */
31 31
 class File extends Str
32 32
 {
33
-    /**
34
-     * Template filename.
35
-     *
36
-     * @var string
37
-     */
38
-    protected $file;
33
+	/**
34
+	 * Template filename.
35
+	 *
36
+	 * @var string
37
+	 */
38
+	protected $file;
39 39
 
40
-    /**
41
-     * Include path(s) to look into to find this template.
42
-     *
43
-     * @var array
44
-     */
45
-    protected $includePath = array();
40
+	/**
41
+	 * Include path(s) to look into to find this template.
42
+	 *
43
+	 * @var array
44
+	 */
45
+	protected $includePath = array();
46 46
 
47
-    /**
48
-     * Resolved path cache when looking for a file in multiple include paths.
49
-     * this is reset when the include path is changed
50
-     *
51
-     * @var string
52
-     */
53
-    protected $resolvedPath = null;
47
+	/**
48
+	 * Resolved path cache when looking for a file in multiple include paths.
49
+	 * this is reset when the include path is changed
50
+	 *
51
+	 * @var string
52
+	 */
53
+	protected $resolvedPath = null;
54 54
 
55
-    /**
56
-     * Creates a template from a file.
57
-     *
58
-     * @param string $file        the path to the template file, make sure it exists
59
-     * @param int    $cacheTime   duration of the cache validity for this template,
60
-     *                            if null it defaults to the Dwoo instance that will
61
-     *                            render this template
62
-     * @param string $cacheId     the unique cache identifier of this page or anything else that
63
-     *                            makes this template's content unique, if null it defaults
64
-     *                            to the current url
65
-     * @param string $compileId   the unique compiled identifier, which is used to distinguish this
66
-     *                            template from others, if null it defaults to the filename+bits of the path
67
-     * @param mixed  $includePath a string for a single path to look into for the given file, or an array of paths
68
-     */
69
-    public function __construct($file, $cacheTime = null, $cacheId = null, $compileId = null, $includePath = array())
70
-    {
71
-        parent::__construct($file, $cacheTime, $cacheId, $compileId);
72
-        $this->template = null;
73
-        $this->file     = $file;
74
-        $this->name     = basename($file);
75
-        $this->setIncludePath($includePath);
76
-    }
55
+	/**
56
+	 * Creates a template from a file.
57
+	 *
58
+	 * @param string $file        the path to the template file, make sure it exists
59
+	 * @param int    $cacheTime   duration of the cache validity for this template,
60
+	 *                            if null it defaults to the Dwoo instance that will
61
+	 *                            render this template
62
+	 * @param string $cacheId     the unique cache identifier of this page or anything else that
63
+	 *                            makes this template's content unique, if null it defaults
64
+	 *                            to the current url
65
+	 * @param string $compileId   the unique compiled identifier, which is used to distinguish this
66
+	 *                            template from others, if null it defaults to the filename+bits of the path
67
+	 * @param mixed  $includePath a string for a single path to look into for the given file, or an array of paths
68
+	 */
69
+	public function __construct($file, $cacheTime = null, $cacheId = null, $compileId = null, $includePath = array())
70
+	{
71
+		parent::__construct($file, $cacheTime, $cacheId, $compileId);
72
+		$this->template = null;
73
+		$this->file     = $file;
74
+		$this->name     = basename($file);
75
+		$this->setIncludePath($includePath);
76
+	}
77 77
 
78
-    /**
79
-     * Sets the include path(s) to where the given template filename must be looked up.
80
-     *
81
-     * @param mixed $paths the path to look into, can be string for a single path or an array of paths
82
-     */
83
-    public function setIncludePath($paths)
84
-    {
85
-        if (is_array($paths) === false) {
86
-            $paths = array($paths);
87
-        }
78
+	/**
79
+	 * Sets the include path(s) to where the given template filename must be looked up.
80
+	 *
81
+	 * @param mixed $paths the path to look into, can be string for a single path or an array of paths
82
+	 */
83
+	public function setIncludePath($paths)
84
+	{
85
+		if (is_array($paths) === false) {
86
+			$paths = array($paths);
87
+		}
88 88
 
89
-        $this->includePath  = $paths;
90
-        $this->resolvedPath = null;
91
-    }
89
+		$this->includePath  = $paths;
90
+		$this->resolvedPath = null;
91
+	}
92 92
 
93
-    /**
94
-     * Return the current include path(s).
95
-     *
96
-     * @return array
97
-     */
98
-    public function getIncludePath()
99
-    {
100
-        return $this->includePath;
101
-    }
93
+	/**
94
+	 * Return the current include path(s).
95
+	 *
96
+	 * @return array
97
+	 */
98
+	public function getIncludePath()
99
+	{
100
+		return $this->includePath;
101
+	}
102 102
 
103
-    /**
104
-     * Checks if compiled file is valid (exists and it's the modification is greater or
105
-     * equal to the modification time of the template file).
106
-     *
107
-     * @param string file
108
-     *
109
-     * @return bool True cache file existance and it's modification time
110
-     */
111
-    protected function isValidCompiledFile($file)
112
-    {
113
-        return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file);
114
-    }
103
+	/**
104
+	 * Checks if compiled file is valid (exists and it's the modification is greater or
105
+	 * equal to the modification time of the template file).
106
+	 *
107
+	 * @param string file
108
+	 *
109
+	 * @return bool True cache file existance and it's modification time
110
+	 */
111
+	protected function isValidCompiledFile($file)
112
+	{
113
+		return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file);
114
+	}
115 115
 
116
-    /**
117
-     * Returns the template source of this template.
118
-     *
119
-     * @return string
120
-     */
121
-    public function getSource()
122
-    {
123
-        return file_get_contents($this->getResourceIdentifier());
124
-    }
116
+	/**
117
+	 * Returns the template source of this template.
118
+	 *
119
+	 * @return string
120
+	 */
121
+	public function getSource()
122
+	{
123
+		return file_get_contents($this->getResourceIdentifier());
124
+	}
125 125
 
126
-    /**
127
-     * Returns the resource name for this template class.
128
-     *
129
-     * @return string
130
-     */
131
-    public function getResourceName()
132
-    {
133
-        return 'file';
134
-    }
126
+	/**
127
+	 * Returns the resource name for this template class.
128
+	 *
129
+	 * @return string
130
+	 */
131
+	public function getResourceName()
132
+	{
133
+		return 'file';
134
+	}
135 135
 
136
-    /**
137
-     * Returns this template's source filename.
138
-     *
139
-     * @return string
140
-     * @throws DwooException
141
-     */
142
-    public function getResourceIdentifier()
143
-    {
144
-        if ($this->resolvedPath !== null) {
145
-            return $this->resolvedPath;
146
-        } elseif (array_filter($this->getIncludePath()) == array()) {
147
-            return $this->file;
148
-        } else {
149
-            foreach ($this->getIncludePath() as $path) {
150
-                $path = rtrim($path, DIRECTORY_SEPARATOR);
151
-                if (file_exists($path . DIRECTORY_SEPARATOR . $this->file) === true) {
152
-                    return $this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file;
153
-                }
154
-            }
136
+	/**
137
+	 * Returns this template's source filename.
138
+	 *
139
+	 * @return string
140
+	 * @throws DwooException
141
+	 */
142
+	public function getResourceIdentifier()
143
+	{
144
+		if ($this->resolvedPath !== null) {
145
+			return $this->resolvedPath;
146
+		} elseif (array_filter($this->getIncludePath()) == array()) {
147
+			return $this->file;
148
+		} else {
149
+			foreach ($this->getIncludePath() as $path) {
150
+				$path = rtrim($path, DIRECTORY_SEPARATOR);
151
+				if (file_exists($path . DIRECTORY_SEPARATOR . $this->file) === true) {
152
+					return $this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file;
153
+				}
154
+			}
155 155
 
156
-            throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)');
157
-        }
158
-    }
156
+			throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)');
157
+		}
158
+	}
159 159
 
160
-    /**
161
-     * Returns an unique value identifying the current version of this template,
162
-     * in this case it's the unix timestamp of the last modification.
163
-     *
164
-     * @return string
165
-     */
166
-    public function getUid()
167
-    {
168
-        return (string)filemtime($this->getResourceIdentifier());
169
-    }
160
+	/**
161
+	 * Returns an unique value identifying the current version of this template,
162
+	 * in this case it's the unix timestamp of the last modification.
163
+	 *
164
+	 * @return string
165
+	 */
166
+	public function getUid()
167
+	{
168
+		return (string)filemtime($this->getResourceIdentifier());
169
+	}
170 170
 
171
-    /**
172
-     * Returns a new template object from the given include name, null if no include is
173
-     * possible (resource not found), or false if include is not permitted by this resource type.
174
-     *
175
-     * @param Core      $core           the dwoo instance requiring it
176
-     * @param mixed     $resourceId     the filename (relative to this template's dir) of the template to
177
-     *                                  include
178
-     * @param int       $cacheTime      duration of the cache validity for this template, if null it defaults
179
-     *                                  to the Dwoo instance that will render this template if null it
180
-     *                                  defaults to the Dwoo instance that will render this template if null
181
-     *                                  it defaults to the Dwoo instance that will render this template
182
-     * @param string    $cacheId        the unique cache identifier of this page or anything else that makes
183
-     *                                  this template's content unique, if null it defaults to the current
184
-     *                                  url makes this template's content unique, if null it defaults to the
185
-     *                                  current url makes this template's content unique, if null it defaults
186
-     *                                  to the current url
187
-     * @param string    $compileId      the unique compiled identifier, which is used to distinguish this
188
-     *                                  template from others, if null it defaults to the filename+bits of the
189
-     *                                  path template from others, if null it defaults to the filename+bits
190
-     *                                  of the path template from others, if null it defaults to the
191
-     *                                  filename+bits of the path
192
-     * @param ITemplate $parentTemplate the template that is requesting a new template object (through an
193
-     *                                  include, extends or any other plugin) an include, extends or any
194
-     *                                  other plugin) an include, extends or any other plugin)
195
-     *
196
-     * @return TemplateFile|null
197
-     * @throws DwooException
198
-     * @throws SecurityException
199
-     */
200
-    public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null,
201
-                                           $compileId = null, ITemplate $parentTemplate = null)
202
-    {
203
-        if (DIRECTORY_SEPARATOR === '\\') {
204
-            $resourceId = str_replace(array("\t", "\n", "\r", "\f", "\v"), array(
205
-                '\\t',
206
-                '\\n',
207
-                '\\r',
208
-                '\\f',
209
-                '\\v'
210
-            ), $resourceId);
211
-        }
212
-        $resourceId = strtr($resourceId, '\\', '/');
171
+	/**
172
+	 * Returns a new template object from the given include name, null if no include is
173
+	 * possible (resource not found), or false if include is not permitted by this resource type.
174
+	 *
175
+	 * @param Core      $core           the dwoo instance requiring it
176
+	 * @param mixed     $resourceId     the filename (relative to this template's dir) of the template to
177
+	 *                                  include
178
+	 * @param int       $cacheTime      duration of the cache validity for this template, if null it defaults
179
+	 *                                  to the Dwoo instance that will render this template if null it
180
+	 *                                  defaults to the Dwoo instance that will render this template if null
181
+	 *                                  it defaults to the Dwoo instance that will render this template
182
+	 * @param string    $cacheId        the unique cache identifier of this page or anything else that makes
183
+	 *                                  this template's content unique, if null it defaults to the current
184
+	 *                                  url makes this template's content unique, if null it defaults to the
185
+	 *                                  current url makes this template's content unique, if null it defaults
186
+	 *                                  to the current url
187
+	 * @param string    $compileId      the unique compiled identifier, which is used to distinguish this
188
+	 *                                  template from others, if null it defaults to the filename+bits of the
189
+	 *                                  path template from others, if null it defaults to the filename+bits
190
+	 *                                  of the path template from others, if null it defaults to the
191
+	 *                                  filename+bits of the path
192
+	 * @param ITemplate $parentTemplate the template that is requesting a new template object (through an
193
+	 *                                  include, extends or any other plugin) an include, extends or any
194
+	 *                                  other plugin) an include, extends or any other plugin)
195
+	 *
196
+	 * @return TemplateFile|null
197
+	 * @throws DwooException
198
+	 * @throws SecurityException
199
+	 */
200
+	public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null,
201
+										   $compileId = null, ITemplate $parentTemplate = null)
202
+	{
203
+		if (DIRECTORY_SEPARATOR === '\\') {
204
+			$resourceId = str_replace(array("\t", "\n", "\r", "\f", "\v"), array(
205
+				'\\t',
206
+				'\\n',
207
+				'\\r',
208
+				'\\f',
209
+				'\\v'
210
+			), $resourceId);
211
+		}
212
+		$resourceId = strtr($resourceId, '\\', '/');
213 213
 
214
-        $includePath = null;
214
+		$includePath = null;
215 215
 
216
-        if (file_exists($resourceId) === false) {
217
-            if ($parentTemplate === null) {
218
-                $parentTemplate = $core->getTemplate();
219
-            }
220
-            if ($parentTemplate instanceof self) {
221
-                if ($includePath = $parentTemplate->getIncludePath()) {
222
-                    if (strstr($resourceId, '../')) {
223
-                        throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)');
224
-                    }
225
-                } else {
226
-                    $resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId;
227
-                    if (file_exists($resourceId) === false) {
228
-                        return null;
229
-                    }
230
-                }
231
-            } else {
232
-                return null;
233
-            }
234
-        }
216
+		if (file_exists($resourceId) === false) {
217
+			if ($parentTemplate === null) {
218
+				$parentTemplate = $core->getTemplate();
219
+			}
220
+			if ($parentTemplate instanceof self) {
221
+				if ($includePath = $parentTemplate->getIncludePath()) {
222
+					if (strstr($resourceId, '../')) {
223
+						throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)');
224
+					}
225
+				} else {
226
+					$resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId;
227
+					if (file_exists($resourceId) === false) {
228
+						return null;
229
+					}
230
+				}
231
+			} else {
232
+				return null;
233
+			}
234
+		}
235 235
 
236
-        if ($policy = $core->getSecurityPolicy()) {
237
-            while (true) {
238
-                if (preg_match('{^([a-z]+?)://}i', $resourceId)) {
239
-                    throw new SecurityException('The security policy prevents you to read files from external sources : <em>' . $resourceId . '</em>.');
240
-                }
236
+		if ($policy = $core->getSecurityPolicy()) {
237
+			while (true) {
238
+				if (preg_match('{^([a-z]+?)://}i', $resourceId)) {
239
+					throw new SecurityException('The security policy prevents you to read files from external sources : <em>' . $resourceId . '</em>.');
240
+				}
241 241
 
242
-                if ($includePath) {
243
-                    break;
244
-                }
242
+				if ($includePath) {
243
+					break;
244
+				}
245 245
 
246
-                $resourceId = realpath($resourceId);
247
-                $dirs       = $policy->getAllowedDirectories();
248
-                foreach ($dirs as $dir => $dummy) {
249
-                    if (strpos($resourceId, $dir) === 0) {
250
-                        break 2;
251
-                    }
252
-                }
253
-                throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>');
254
-            }
255
-        }
246
+				$resourceId = realpath($resourceId);
247
+				$dirs       = $policy->getAllowedDirectories();
248
+				foreach ($dirs as $dir => $dummy) {
249
+					if (strpos($resourceId, $dir) === 0) {
250
+						break 2;
251
+					}
252
+				}
253
+				throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>');
254
+			}
255
+		}
256 256
 
257
-        $class = 'Dwoo\Template\File';
258
-        if ($parentTemplate) {
259
-            $class = get_class($parentTemplate);
260
-        }
257
+		$class = 'Dwoo\Template\File';
258
+		if ($parentTemplate) {
259
+			$class = get_class($parentTemplate);
260
+		}
261 261
 
262
-        return new $class($resourceId, $cacheTime, $cacheId, $compileId, $includePath);
263
-    }
262
+		return new $class($resourceId, $cacheTime, $cacheId, $compileId, $includePath);
263
+	}
264 264
 
265
-    /**
266
-     * Returns the full compiled file name and assigns a default value to it if
267
-     * required.
268
-     *
269
-     * @param Core $core the Core instance that requests the file name
270
-     *
271
-     * @return string the full path to the compiled file
272
-     */
273
-    protected function getCompiledFilename(Core $core)
274
-    {
275
-        // no compile id was provided, set default
276
-        if ($this->compileId === null) {
277
-            $this->compileId = $this->getResourceIdentifier();
278
-        }
265
+	/**
266
+	 * Returns the full compiled file name and assigns a default value to it if
267
+	 * required.
268
+	 *
269
+	 * @param Core $core the Core instance that requests the file name
270
+	 *
271
+	 * @return string the full path to the compiled file
272
+	 */
273
+	protected function getCompiledFilename(Core $core)
274
+	{
275
+		// no compile id was provided, set default
276
+		if ($this->compileId === null) {
277
+			$this->compileId = $this->getResourceIdentifier();
278
+		}
279 279
 
280
-        return $this->compileId . '.d' . Core::RELEASE_TAG . '.php';
281
-    }
280
+		return $this->compileId . '.d' . Core::RELEASE_TAG . '.php';
281
+	}
282 282
 
283
-    /**
284
-     * Returns some php code that will check if this template has been modified or not.
285
-     * if the function returns null, the template will be instanciated and then the Uid checked
286
-     *
287
-     * @return string
288
-     */
289
-    public function getIsModifiedCode()
290
-    {
291
-        return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')';
292
-    }
283
+	/**
284
+	 * Returns some php code that will check if this template has been modified or not.
285
+	 * if the function returns null, the template will be instanciated and then the Uid checked
286
+	 *
287
+	 * @return string
288
+	 */
289
+	public function getIsModifiedCode()
290
+	{
291
+		return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')';
292
+	}
293 293
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     protected function isValidCompiledFile($file)
112 112
     {
113
-        return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file);
113
+        return parent::isValidCompiledFile($file) && (int) $this->getUid() <= filemtime($file);
114 114
     }
115 115
 
116 116
     /**
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
         } else {
149 149
             foreach ($this->getIncludePath() as $path) {
150 150
                 $path = rtrim($path, DIRECTORY_SEPARATOR);
151
-                if (file_exists($path . DIRECTORY_SEPARATOR . $this->file) === true) {
152
-                    return $this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file;
151
+                if (file_exists($path.DIRECTORY_SEPARATOR.$this->file) === true) {
152
+                    return $this->resolvedPath = $path.DIRECTORY_SEPARATOR.$this->file;
153 153
                 }
154 154
             }
155 155
 
156
-            throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)');
156
+            throw new DwooException('Template "'.$this->file.'" could not be found in any of your include path(s)');
157 157
         }
158 158
     }
159 159
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function getUid()
167 167
     {
168
-        return (string)filemtime($this->getResourceIdentifier());
168
+        return (string) filemtime($this->getResourceIdentifier());
169 169
     }
170 170
 
171 171
     /**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                         throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)');
224 224
                     }
225 225
                 } else {
226
-                    $resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId;
226
+                    $resourceId = dirname($parentTemplate->getResourceIdentifier()).DIRECTORY_SEPARATOR.$resourceId;
227 227
                     if (file_exists($resourceId) === false) {
228 228
                         return null;
229 229
                     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         if ($policy = $core->getSecurityPolicy()) {
237 237
             while (true) {
238 238
                 if (preg_match('{^([a-z]+?)://}i', $resourceId)) {
239
-                    throw new SecurityException('The security policy prevents you to read files from external sources : <em>' . $resourceId . '</em>.');
239
+                    throw new SecurityException('The security policy prevents you to read files from external sources : <em>'.$resourceId.'</em>.');
240 240
                 }
241 241
 
242 242
                 if ($includePath) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                         break 2;
251 251
                     }
252 252
                 }
253
-                throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>');
253
+                throw new SecurityException('The security policy prevents you to read <em>'.$resourceId.'</em>');
254 254
             }
255 255
         }
256 256
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             $this->compileId = $this->getResourceIdentifier();
278 278
         }
279 279
 
280
-        return $this->compileId . '.d' . Core::RELEASE_TAG . '.php';
280
+        return $this->compileId.'.d'.Core::RELEASE_TAG.'.php';
281 281
     }
282 282
 
283 283
     /**
@@ -288,6 +288,6 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public function getIsModifiedCode()
290 290
     {
291
-        return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')';
291
+        return '"'.$this->getUid().'" == filemtime('.var_export($this->getResourceIdentifier(), true).')';
292 292
     }
293 293
 }
Please login to merge, or discard this patch.
lib/Dwoo/Data.php 2 patches
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -24,241 +24,241 @@
 block discarded – undo
24 24
  */
25 25
 class Data implements IDataProvider
26 26
 {
27
-    /**
28
-     * Data array.
29
-     *
30
-     * @var array
31
-     */
32
-    protected $data = array();
27
+	/**
28
+	 * Data array.
29
+	 *
30
+	 * @var array
31
+	 */
32
+	protected $data = array();
33 33
 
34
-    /**
35
-     * Returns the data array.
36
-     *
37
-     * @return array
38
-     */
39
-    public function getData()
40
-    {
41
-        return $this->data;
42
-    }
34
+	/**
35
+	 * Returns the data array.
36
+	 *
37
+	 * @return array
38
+	 */
39
+	public function getData()
40
+	{
41
+		return $this->data;
42
+	}
43 43
 
44
-    /**
45
-     * Clears a the entire data or only the given key.
46
-     *
47
-     * @param array|string $name clears only one value if you give a name, multiple values if
48
-     *                           you give an array of names, or the entire data if left null
49
-     */
50
-    public function clear($name = null)
51
-    {
52
-        if ($name === null) {
53
-            $this->data = array();
54
-        } elseif (is_array($name)) {
55
-            foreach ($name as $index) {
56
-                unset($this->data[$index]);
57
-            }
58
-        } else {
59
-            unset($this->data[$name]);
60
-        }
61
-    }
44
+	/**
45
+	 * Clears a the entire data or only the given key.
46
+	 *
47
+	 * @param array|string $name clears only one value if you give a name, multiple values if
48
+	 *                           you give an array of names, or the entire data if left null
49
+	 */
50
+	public function clear($name = null)
51
+	{
52
+		if ($name === null) {
53
+			$this->data = array();
54
+		} elseif (is_array($name)) {
55
+			foreach ($name as $index) {
56
+				unset($this->data[$index]);
57
+			}
58
+		} else {
59
+			unset($this->data[$name]);
60
+		}
61
+	}
62 62
 
63
-    /**
64
-     * Overwrites the entire data with the given array.
65
-     *
66
-     * @param array $data the new data array to use
67
-     */
68
-    public function setData(array $data)
69
-    {
70
-        $this->data = $data;
71
-    }
63
+	/**
64
+	 * Overwrites the entire data with the given array.
65
+	 *
66
+	 * @param array $data the new data array to use
67
+	 */
68
+	public function setData(array $data)
69
+	{
70
+		$this->data = $data;
71
+	}
72 72
 
73
-    /**
74
-     * merges the given array(s) with the current data with array_merge.
75
-     *
76
-     * @param array $data  the array to merge
77
-     */
78
-    public function mergeData(array $data)
79
-    {
80
-        $args = func_get_args();
81
-        foreach ($args as $key => $v) {
82
-            if (is_array($v)) {
83
-                $this->data = array_merge($this->data, $v);
84
-            }
85
-        }
86
-    }
73
+	/**
74
+	 * merges the given array(s) with the current data with array_merge.
75
+	 *
76
+	 * @param array $data  the array to merge
77
+	 */
78
+	public function mergeData(array $data)
79
+	{
80
+		$args = func_get_args();
81
+		foreach ($args as $key => $v) {
82
+			if (is_array($v)) {
83
+				$this->data = array_merge($this->data, $v);
84
+			}
85
+		}
86
+	}
87 87
 
88
-    /**
89
-     * Assigns a value or an array of values to the data object.
90
-     *
91
-     * @param array|string $name an associative array of multiple (index=>value) or a string
92
-     *                           that is the index to use, i.e. a value assigned to "foo" will be
93
-     *                           accessible in the template through {$foo}
94
-     * @param mixed        $val  the value to assign, or null if $name was an array
95
-     */
96
-    public function assign($name, $val = null)
97
-    {
98
-        if (is_array($name)) {
99
-            reset($name);
100
-            foreach ($name as $k => $v){
101
-                $this->data[$k] = $v;
102
-            }
103
-        } else {
104
-            $this->data[$name] = $val;
105
-        }
106
-    }
88
+	/**
89
+	 * Assigns a value or an array of values to the data object.
90
+	 *
91
+	 * @param array|string $name an associative array of multiple (index=>value) or a string
92
+	 *                           that is the index to use, i.e. a value assigned to "foo" will be
93
+	 *                           accessible in the template through {$foo}
94
+	 * @param mixed        $val  the value to assign, or null if $name was an array
95
+	 */
96
+	public function assign($name, $val = null)
97
+	{
98
+		if (is_array($name)) {
99
+			reset($name);
100
+			foreach ($name as $k => $v){
101
+				$this->data[$k] = $v;
102
+			}
103
+		} else {
104
+			$this->data[$name] = $val;
105
+		}
106
+	}
107 107
 
108
-    /**
109
-     * Allows to assign variables using the object syntax.
110
-     *
111
-     * @param string $name  the variable name
112
-     * @param string $value the value to assign to it
113
-     */
114
-    public function __set($name, $value)
115
-    {
116
-        $this->assign($name, $value);
117
-    }
108
+	/**
109
+	 * Allows to assign variables using the object syntax.
110
+	 *
111
+	 * @param string $name  the variable name
112
+	 * @param string $value the value to assign to it
113
+	 */
114
+	public function __set($name, $value)
115
+	{
116
+		$this->assign($name, $value);
117
+	}
118 118
 
119
-    /**
120
-     * Assigns a value by reference to the data object.
121
-     *
122
-     * @param string $name the index to use, i.e. a value assigned to "foo" will be
123
-     *                     accessible in the template through {$foo}
124
-     * @param mixed  $val  the value to assign by reference
125
-     */
126
-    public function assignByRef($name, &$val)
127
-    {
128
-        $this->data[$name] = &$val;
129
-    }
119
+	/**
120
+	 * Assigns a value by reference to the data object.
121
+	 *
122
+	 * @param string $name the index to use, i.e. a value assigned to "foo" will be
123
+	 *                     accessible in the template through {$foo}
124
+	 * @param mixed  $val  the value to assign by reference
125
+	 */
126
+	public function assignByRef($name, &$val)
127
+	{
128
+		$this->data[$name] = &$val;
129
+	}
130 130
 
131
-    /**
132
-     * Appends values or an array of values to the data object.
133
-     *
134
-     * @param array|string $name  an associative array of multiple (index=>value) or a string
135
-     *                            that is the index to use, i.e. a value assigned to "foo" will be
136
-     *                            accessible in the template through {$foo}
137
-     * @param mixed        $val   the value to assign, or null if $name was an array
138
-     * @param bool         $merge true to merge data or false to append, defaults to false
139
-     */
140
-    public function append($name, $val = null, $merge = false)
141
-    {
142
-        if (is_array($name)) {
143
-            foreach ($name as $key => $val) {
144
-                if (isset($this->data[$key]) && !is_array($this->data[$key])) {
145
-                    settype($this->data[$key], 'array');
146
-                }
131
+	/**
132
+	 * Appends values or an array of values to the data object.
133
+	 *
134
+	 * @param array|string $name  an associative array of multiple (index=>value) or a string
135
+	 *                            that is the index to use, i.e. a value assigned to "foo" will be
136
+	 *                            accessible in the template through {$foo}
137
+	 * @param mixed        $val   the value to assign, or null if $name was an array
138
+	 * @param bool         $merge true to merge data or false to append, defaults to false
139
+	 */
140
+	public function append($name, $val = null, $merge = false)
141
+	{
142
+		if (is_array($name)) {
143
+			foreach ($name as $key => $val) {
144
+				if (isset($this->data[$key]) && !is_array($this->data[$key])) {
145
+					settype($this->data[$key], 'array');
146
+				}
147 147
 
148
-                if ($merge === true && is_array($val)) {
149
-                    $this->data[$key] = $val + $this->data[$key];
150
-                } else {
151
-                    $this->data[$key][] = $val;
152
-                }
153
-            }
154
-        } elseif ($val !== null) {
155
-            if (isset($this->data[$name]) && !is_array($this->data[$name])) {
156
-                settype($this->data[$name], 'array');
157
-            } elseif (!isset($this->data[$name])) {
158
-                $this->data[$name] = array();
159
-            }
148
+				if ($merge === true && is_array($val)) {
149
+					$this->data[$key] = $val + $this->data[$key];
150
+				} else {
151
+					$this->data[$key][] = $val;
152
+				}
153
+			}
154
+		} elseif ($val !== null) {
155
+			if (isset($this->data[$name]) && !is_array($this->data[$name])) {
156
+				settype($this->data[$name], 'array');
157
+			} elseif (!isset($this->data[$name])) {
158
+				$this->data[$name] = array();
159
+			}
160 160
 
161
-            if ($merge === true && is_array($val)) {
162
-                $this->data[$name] = $val + $this->data[$name];
163
-            } else {
164
-                $this->data[$name][] = $val;
165
-            }
166
-        }
167
-    }
161
+			if ($merge === true && is_array($val)) {
162
+				$this->data[$name] = $val + $this->data[$name];
163
+			} else {
164
+				$this->data[$name][] = $val;
165
+			}
166
+		}
167
+	}
168 168
 
169
-    /**
170
-     * Appends a value by reference to the data object.
171
-     *
172
-     * @param string $name  the index to use, i.e. a value assigned to "foo" will be
173
-     *                      accessible in the template through {$foo}
174
-     * @param mixed  $val   the value to append by reference
175
-     * @param bool   $merge true to merge data or false to append, defaults to false
176
-     */
177
-    public function appendByRef($name, &$val, $merge = false)
178
-    {
179
-        if (isset($this->data[$name]) && !is_array($this->data[$name])) {
180
-            settype($this->data[$name], 'array');
181
-        }
169
+	/**
170
+	 * Appends a value by reference to the data object.
171
+	 *
172
+	 * @param string $name  the index to use, i.e. a value assigned to "foo" will be
173
+	 *                      accessible in the template through {$foo}
174
+	 * @param mixed  $val   the value to append by reference
175
+	 * @param bool   $merge true to merge data or false to append, defaults to false
176
+	 */
177
+	public function appendByRef($name, &$val, $merge = false)
178
+	{
179
+		if (isset($this->data[$name]) && !is_array($this->data[$name])) {
180
+			settype($this->data[$name], 'array');
181
+		}
182 182
 
183
-        if ($merge === true && is_array($val)) {
184
-            foreach ($val as $key => &$value) {
185
-                $this->data[$name][$key] = &$value;
186
-            }
187
-        } else {
188
-            $this->data[$name][] = &$val;
189
-        }
190
-    }
183
+		if ($merge === true && is_array($val)) {
184
+			foreach ($val as $key => &$value) {
185
+				$this->data[$name][$key] = &$value;
186
+			}
187
+		} else {
188
+			$this->data[$name][] = &$val;
189
+		}
190
+	}
191 191
 
192
-    /**
193
-     * Returns true if the variable has been assigned already, false otherwise.
194
-     *
195
-     * @param string $name the variable name
196
-     *
197
-     * @return bool
198
-     */
199
-    public function isAssigned($name)
200
-    {
201
-        return isset($this->data[$name]);
202
-    }
192
+	/**
193
+	 * Returns true if the variable has been assigned already, false otherwise.
194
+	 *
195
+	 * @param string $name the variable name
196
+	 *
197
+	 * @return bool
198
+	 */
199
+	public function isAssigned($name)
200
+	{
201
+		return isset($this->data[$name]);
202
+	}
203 203
 
204
-    /**
205
-     * Supports calls to isset($dwoo->var).
206
-     *
207
-     * @param string $name the variable name
208
-     *
209
-     * @return bool
210
-     */
211
-    public function __isset($name)
212
-    {
213
-        return isset($this->data[$name]);
214
-    }
204
+	/**
205
+	 * Supports calls to isset($dwoo->var).
206
+	 *
207
+	 * @param string $name the variable name
208
+	 *
209
+	 * @return bool
210
+	 */
211
+	public function __isset($name)
212
+	{
213
+		return isset($this->data[$name]);
214
+	}
215 215
 
216
-    /**
217
-     * Unassigns/removes a variable.
218
-     *
219
-     * @param string $name the variable name
220
-     */
221
-    public function unassign($name)
222
-    {
223
-        unset($this->data[$name]);
224
-    }
216
+	/**
217
+	 * Unassigns/removes a variable.
218
+	 *
219
+	 * @param string $name the variable name
220
+	 */
221
+	public function unassign($name)
222
+	{
223
+		unset($this->data[$name]);
224
+	}
225 225
 
226
-    /**
227
-     * Supports unsetting variables using the object syntax.
228
-     *
229
-     * @param string $name the variable name
230
-     */
231
-    public function __unset($name)
232
-    {
233
-        unset($this->data[$name]);
234
-    }
226
+	/**
227
+	 * Supports unsetting variables using the object syntax.
228
+	 *
229
+	 * @param string $name the variable name
230
+	 */
231
+	public function __unset($name)
232
+	{
233
+		unset($this->data[$name]);
234
+	}
235 235
 
236
-    /**
237
-     * Returns a variable if it was assigned.
238
-     *
239
-     * @param string $name the variable name
240
-     *
241
-     * @return mixed
242
-     */
243
-    public function get($name)
244
-    {
245
-        return $this->__get($name);
246
-    }
236
+	/**
237
+	 * Returns a variable if it was assigned.
238
+	 *
239
+	 * @param string $name the variable name
240
+	 *
241
+	 * @return mixed
242
+	 */
243
+	public function get($name)
244
+	{
245
+		return $this->__get($name);
246
+	}
247 247
 
248
-    /**
249
-     * Allows to read variables using the object syntax.
250
-     *
251
-     * @param string $name the variable name
252
-     *
253
-     * @return mixed
254
-     * @throws Exception
255
-     */
256
-    public function __get($name)
257
-    {
258
-        if (isset($this->data[$name])) {
259
-            return $this->data[$name];
260
-        } else {
261
-            throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"');
262
-        }
263
-    }
248
+	/**
249
+	 * Allows to read variables using the object syntax.
250
+	 *
251
+	 * @param string $name the variable name
252
+	 *
253
+	 * @return mixed
254
+	 * @throws Exception
255
+	 */
256
+	public function __get($name)
257
+	{
258
+		if (isset($this->data[$name])) {
259
+			return $this->data[$name];
260
+		} else {
261
+			throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"');
262
+		}
263
+	}
264 264
 }
Please login to merge, or discard this 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/ITemplate.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -23,139 +23,139 @@
 block discarded – undo
23 23
  */
24 24
 interface ITemplate
25 25
 {
26
-    /**
27
-     * Returns the cache duration for this template.
28
-     * defaults to null if it was not provided
29
-     *
30
-     * @return int|null
31
-     */
32
-    public function getCacheTime();
26
+	/**
27
+	 * Returns the cache duration for this template.
28
+	 * defaults to null if it was not provided
29
+	 *
30
+	 * @return int|null
31
+	 */
32
+	public function getCacheTime();
33 33
 
34
-    /**
35
-     * Sets the cache duration for this template.
36
-     * can be used to set it after the object is created if you did not provide
37
-     * it in the constructor
38
-     *
39
-     * @param int $seconds duration of the cache validity for this template, if
40
-     *                     null it defaults to the Dwoo instance's cache time. 0 = disable and
41
-     *                     -1 = infinite cache
42
-     */
43
-    public function setCacheTime($seconds = null);
34
+	/**
35
+	 * Sets the cache duration for this template.
36
+	 * can be used to set it after the object is created if you did not provide
37
+	 * it in the constructor
38
+	 *
39
+	 * @param int $seconds duration of the cache validity for this template, if
40
+	 *                     null it defaults to the Dwoo instance's cache time. 0 = disable and
41
+	 *                     -1 = infinite cache
42
+	 */
43
+	public function setCacheTime($seconds = null);
44 44
 
45
-    /**
46
-     * Returns the cached template output file name, true if it's cache-able but not cached
47
-     * or false if it's not cached.
48
-     *
49
-     * @param Core $core the dwoo instance that requests it
50
-     *
51
-     * @return string|bool
52
-     */
53
-    public function getCachedTemplate(Core $core);
45
+	/**
46
+	 * Returns the cached template output file name, true if it's cache-able but not cached
47
+	 * or false if it's not cached.
48
+	 *
49
+	 * @param Core $core the dwoo instance that requests it
50
+	 *
51
+	 * @return string|bool
52
+	 */
53
+	public function getCachedTemplate(Core $core);
54 54
 
55
-    /**
56
-     * Caches the provided output into the cache file.
57
-     *
58
-     * @param Core   $core   the dwoo instance that requests it
59
-     * @param string $output the template output
60
-     *
61
-     * @return mixed full path of the cached file or false upon failure
62
-     */
63
-    public function cache(Core $core, $output);
55
+	/**
56
+	 * Caches the provided output into the cache file.
57
+	 *
58
+	 * @param Core   $core   the dwoo instance that requests it
59
+	 * @param string $output the template output
60
+	 *
61
+	 * @return mixed full path of the cached file or false upon failure
62
+	 */
63
+	public function cache(Core $core, $output);
64 64
 
65
-    /**
66
-     * Clears the cached template if it's older than the given time.
67
-     *
68
-     * @param Core $core      the dwoo instance that was used to cache that template
69
-     * @param int  $olderThan minimum time (in seconds) required for the cache to be cleared
70
-     *
71
-     * @return bool true if the cache was not present or if it was deleted, false if it remains there
72
-     */
73
-    public function clearCache(Core $core, $olderThan = - 1);
65
+	/**
66
+	 * Clears the cached template if it's older than the given time.
67
+	 *
68
+	 * @param Core $core      the dwoo instance that was used to cache that template
69
+	 * @param int  $olderThan minimum time (in seconds) required for the cache to be cleared
70
+	 *
71
+	 * @return bool true if the cache was not present or if it was deleted, false if it remains there
72
+	 */
73
+	public function clearCache(Core $core, $olderThan = - 1);
74 74
 
75
-    /**
76
-     * Returns the compiled template file name.
77
-     *
78
-     * @param Core      $core     the dwoo instance that requests it
79
-     * @param ICompiler $compiler the compiler that must be used
80
-     *
81
-     * @return string
82
-     */
83
-    public function getCompiledTemplate(Core $core, ICompiler $compiler = null);
75
+	/**
76
+	 * Returns the compiled template file name.
77
+	 *
78
+	 * @param Core      $core     the dwoo instance that requests it
79
+	 * @param ICompiler $compiler the compiler that must be used
80
+	 *
81
+	 * @return string
82
+	 */
83
+	public function getCompiledTemplate(Core $core, ICompiler $compiler = null);
84 84
 
85
-    /**
86
-     * Returns the template name.
87
-     *
88
-     * @return string
89
-     */
90
-    public function getName();
85
+	/**
86
+	 * Returns the template name.
87
+	 *
88
+	 * @return string
89
+	 */
90
+	public function getName();
91 91
 
92
-    /**
93
-     * Returns the resource name for this template class.
94
-     *
95
-     * @return string
96
-     */
97
-    public function getResourceName();
92
+	/**
93
+	 * Returns the resource name for this template class.
94
+	 *
95
+	 * @return string
96
+	 */
97
+	public function getResourceName();
98 98
 
99
-    /**
100
-     * Returns the resource identifier for this template or false if it has no identifier.
101
-     *
102
-     * @return string|false
103
-     */
104
-    public function getResourceIdentifier();
99
+	/**
100
+	 * Returns the resource identifier for this template or false if it has no identifier.
101
+	 *
102
+	 * @return string|false
103
+	 */
104
+	public function getResourceIdentifier();
105 105
 
106
-    /**
107
-     * Returns the template source of this template.
108
-     *
109
-     * @return string
110
-     */
111
-    public function getSource();
106
+	/**
107
+	 * Returns the template source of this template.
108
+	 *
109
+	 * @return string
110
+	 */
111
+	public function getSource();
112 112
 
113
-    /**
114
-     * Returns an unique string identifying the current version of this template,
115
-     * for example a timestamp of the last modified date or a hash of the template source.
116
-     *
117
-     * @return string
118
-     */
119
-    public function getUid();
113
+	/**
114
+	 * Returns an unique string identifying the current version of this template,
115
+	 * for example a timestamp of the last modified date or a hash of the template source.
116
+	 *
117
+	 * @return string
118
+	 */
119
+	public function getUid();
120 120
 
121
-    /**
122
-     * Returns the compiler used by this template, if it was just compiled, or null.
123
-     *
124
-     * @return ICompiler
125
-     */
126
-    public function getCompiler();
121
+	/**
122
+	 * Returns the compiler used by this template, if it was just compiled, or null.
123
+	 *
124
+	 * @return ICompiler
125
+	 */
126
+	public function getCompiler();
127 127
 
128
-    /**
129
-     * Returns some php code that will check if this template has been modified or not.
130
-     * if the function returns null, the template will be instanciated and then the Uid checked
131
-     *
132
-     * @return string
133
-     */
134
-    public function getIsModifiedCode();
128
+	/**
129
+	 * Returns some php code that will check if this template has been modified or not.
130
+	 * if the function returns null, the template will be instanciated and then the Uid checked
131
+	 *
132
+	 * @return string
133
+	 */
134
+	public function getIsModifiedCode();
135 135
 
136
-    /**
137
-     * Returns a new template object from the given resource identifier, null if no include is
138
-     * possible (resource not found), or false if include is not permitted by this resource type.
139
-     * this method should also check if $dwoo->getSecurityPolicy() is null or not and do the
140
-     * necessary permission checks if required, if the security policy prevents the template
141
-     * generation it should throw a new Security\Exception with a relevant message
142
-     *
143
-     * @param Core      $core
144
-     * @param mixed     $resourceId     the resource identifier
145
-     * @param int       $cacheTime      duration of the cache validity for this template, if null it defaults to the
146
-     *                                  Dwoo instance that will render this template if null it defaults to the Dwoo
147
-     *                                  instance that will render this template
148
-     * @param string    $cacheId        the unique cache identifier of this page or anything else that makes this
149
-     *                                  template's content unique, if null it defaults to the current url makes this
150
-     *                                  template's content unique, if null it defaults to the current url
151
-     * @param string    $compileId      the unique compiled identifier, which is used to distinguish this template from
152
-     *                                  others, if null it defaults to the filename+bits of the path template from
153
-     *                                  others, if null it defaults to the filename+bits of the path
154
-     * @param ITemplate $parentTemplate the template that is requesting a new template object (through an include,
155
-     *                                  extends or any other plugin) an include, extends or any other plugin)
156
-     *
157
-     * @return ITemplate|false|null
158
-     */
159
-    public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null,
160
-                                           $compileId = null, ITemplate $parentTemplate = null);
136
+	/**
137
+	 * Returns a new template object from the given resource identifier, null if no include is
138
+	 * possible (resource not found), or false if include is not permitted by this resource type.
139
+	 * this method should also check if $dwoo->getSecurityPolicy() is null or not and do the
140
+	 * necessary permission checks if required, if the security policy prevents the template
141
+	 * generation it should throw a new Security\Exception with a relevant message
142
+	 *
143
+	 * @param Core      $core
144
+	 * @param mixed     $resourceId     the resource identifier
145
+	 * @param int       $cacheTime      duration of the cache validity for this template, if null it defaults to the
146
+	 *                                  Dwoo instance that will render this template if null it defaults to the Dwoo
147
+	 *                                  instance that will render this template
148
+	 * @param string    $cacheId        the unique cache identifier of this page or anything else that makes this
149
+	 *                                  template's content unique, if null it defaults to the current url makes this
150
+	 *                                  template's content unique, if null it defaults to the current url
151
+	 * @param string    $compileId      the unique compiled identifier, which is used to distinguish this template from
152
+	 *                                  others, if null it defaults to the filename+bits of the path template from
153
+	 *                                  others, if null it defaults to the filename+bits of the path
154
+	 * @param ITemplate $parentTemplate the template that is requesting a new template object (through an include,
155
+	 *                                  extends or any other plugin) an include, extends or any other plugin)
156
+	 *
157
+	 * @return ITemplate|false|null
158
+	 */
159
+	public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null,
160
+										   $compileId = null, ITemplate $parentTemplate = null);
161 161
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCapitalize.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -29,28 +29,28 @@
 block discarded – undo
29 29
  */
30 30
 class PluginCapitalize extends Plugin
31 31
 {
32
-    /**
33
-     * @param string $value
34
-     * @param bool   $numwords
35
-     *
36
-     * @return string
37
-     */
38
-    public function process($value, $numwords = false)
39
-    {
40
-        if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
41
-            return mb_convert_case((string)$value, MB_CASE_TITLE, $this->core->getCharset());
42
-        } else {
43
-            $bits = explode(' ', (string)$value);
44
-            $out  = '';
45
-            foreach ($bits as $k => $v){
46
-                if (preg_match('#^[^0-9]+$#', $v)) {
47
-                    $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
48
-                } else {
49
-                    $out .= ' ' . $v;
50
-                }
51
-            }
32
+	/**
33
+	 * @param string $value
34
+	 * @param bool   $numwords
35
+	 *
36
+	 * @return string
37
+	 */
38
+	public function process($value, $numwords = false)
39
+	{
40
+		if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
41
+			return mb_convert_case((string)$value, MB_CASE_TITLE, $this->core->getCharset());
42
+		} else {
43
+			$bits = explode(' ', (string)$value);
44
+			$out  = '';
45
+			foreach ($bits as $k => $v){
46
+				if (preg_match('#^[^0-9]+$#', $v)) {
47
+					$out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
48
+				} else {
49
+					$out .= ' ' . $v;
50
+				}
51
+			}
52 52
 
53
-            return substr($out, 1);
54
-        }
55
-    }
53
+			return substr($out, 1);
54
+		}
55
+	}
56 56
 }
Please login to merge, or discard this 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.