Test Failed
Pull Request — master (#64)
by David
03:05
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   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -30,247 +30,247 @@
 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 = [];
40
+	/**
41
+	 * Include path(s) to look into to find this template.
42
+	 *
43
+	 * @var array
44
+	 */
45
+	protected $includePath = [];
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 = [])
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
-        $this->compileId = $this->getResourceIdentifier();
77
-    }
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 = [])
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
+		$this->compileId = $this->getResourceIdentifier();
77
+	}
78 78
 
79
-    /**
80
-     * Sets the include path(s) to where the given template filename must be looked up.
81
-     *
82
-     * @param mixed $paths the path to look into, can be string for a single path or an array of paths
83
-     */
84
-    public function setIncludePath($paths)
85
-    {
86
-        if (is_array($paths) === false) {
87
-            $paths = [$paths];
88
-        }
79
+	/**
80
+	 * Sets the include path(s) to where the given template filename must be looked up.
81
+	 *
82
+	 * @param mixed $paths the path to look into, can be string for a single path or an array of paths
83
+	 */
84
+	public function setIncludePath($paths)
85
+	{
86
+		if (is_array($paths) === false) {
87
+			$paths = [$paths];
88
+		}
89 89
 
90
-        $this->includePath  = $paths;
91
-        $this->resolvedPath = null;
92
-    }
90
+		$this->includePath  = $paths;
91
+		$this->resolvedPath = null;
92
+	}
93 93
 
94
-    /**
95
-     * Return the current include path(s).
96
-     *
97
-     * @return array
98
-     */
99
-    public function getIncludePath()
100
-    {
101
-        return $this->includePath;
102
-    }
94
+	/**
95
+	 * Return the current include path(s).
96
+	 *
97
+	 * @return array
98
+	 */
99
+	public function getIncludePath()
100
+	{
101
+		return $this->includePath;
102
+	}
103 103
 
104
-    /**
105
-     * Checks if compiled file is valid (exists and it's the modification is greater or
106
-     * equal to the modification time of the template file).
107
-     *
108
-     * @param string file
109
-     *
110
-     * @return bool True cache file existance and it's modification time
111
-     */
112
-    protected function isValidCompiledFile($file)
113
-    {
114
-        return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file);
115
-    }
104
+	/**
105
+	 * Checks if compiled file is valid (exists and it's the modification is greater or
106
+	 * equal to the modification time of the template file).
107
+	 *
108
+	 * @param string file
109
+	 *
110
+	 * @return bool True cache file existance and it's modification time
111
+	 */
112
+	protected function isValidCompiledFile($file)
113
+	{
114
+		return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file);
115
+	}
116 116
 
117
-    /**
118
-     * Returns the template source of this template.
119
-     *
120
-     * @return string
121
-     */
122
-    public function getSource()
123
-    {
124
-        return file_get_contents($this->getResourceIdentifier());
125
-    }
117
+	/**
118
+	 * Returns the template source of this template.
119
+	 *
120
+	 * @return string
121
+	 */
122
+	public function getSource()
123
+	{
124
+		return file_get_contents($this->getResourceIdentifier());
125
+	}
126 126
 
127
-    /**
128
-     * Returns the resource name for this template class.
129
-     *
130
-     * @return string
131
-     */
132
-    public function getResourceName()
133
-    {
134
-        return 'file';
135
-    }
127
+	/**
128
+	 * Returns the resource name for this template class.
129
+	 *
130
+	 * @return string
131
+	 */
132
+	public function getResourceName()
133
+	{
134
+		return 'file';
135
+	}
136 136
 
137
-    /**
138
-     * Returns this template's source filename.
139
-     *
140
-     * @return string
141
-     * @throws DwooException
142
-     */
143
-    public function getResourceIdentifier()
144
-    {
145
-        if ($this->resolvedPath !== null) {
146
-            return $this->resolvedPath;
147
-        } elseif (array_filter($this->getIncludePath()) == []) {
148
-            return $this->file;
149
-        } else {
150
-            foreach ($this->getIncludePath() as $path) {
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;
154
-                }
155
-            }
137
+	/**
138
+	 * Returns this template's source filename.
139
+	 *
140
+	 * @return string
141
+	 * @throws DwooException
142
+	 */
143
+	public function getResourceIdentifier()
144
+	{
145
+		if ($this->resolvedPath !== null) {
146
+			return $this->resolvedPath;
147
+		} elseif (array_filter($this->getIncludePath()) == []) {
148
+			return $this->file;
149
+		} else {
150
+			foreach ($this->getIncludePath() as $path) {
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;
154
+				}
155
+			}
156 156
 
157
-            throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)');
158
-        }
159
-    }
157
+			throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)');
158
+		}
159
+	}
160 160
 
161
-    /**
162
-     * Returns an unique value identifying the current version of this template,
163
-     * in this case it's the unix timestamp of the last modification.
164
-     *
165
-     * @return string
166
-     */
167
-    public function getUid()
168
-    {
169
-        return (string)filemtime($this->getResourceIdentifier());
170
-    }
161
+	/**
162
+	 * Returns an unique value identifying the current version of this template,
163
+	 * in this case it's the unix timestamp of the last modification.
164
+	 *
165
+	 * @return string
166
+	 */
167
+	public function getUid()
168
+	{
169
+		return (string)filemtime($this->getResourceIdentifier());
170
+	}
171 171
 
172
-    /**
173
-     * Returns a new template object from the given include name, null if no include is
174
-     * possible (resource not found), or false if include is not permitted by this resource type.
175
-     *
176
-     * @param Core      $core           the dwoo instance requiring it
177
-     * @param mixed     $resourceId     the filename (relative to this template's dir) of the template to
178
-     *                                  include
179
-     * @param int       $cacheTime      duration of the cache validity for this template, if null it defaults
180
-     *                                  to the Dwoo instance that will render this template if null it
181
-     *                                  defaults to the Dwoo instance that will render this template if null
182
-     *                                  it defaults to the Dwoo instance that will render this template
183
-     * @param string    $cacheId        the unique cache identifier of this page or anything else that makes
184
-     *                                  this template's content unique, if null it defaults to the current
185
-     *                                  url makes this template's content unique, if null it defaults to the
186
-     *                                  current url makes this template's content unique, if null it defaults
187
-     *                                  to the current url
188
-     * @param string    $compileId      the unique compiled identifier, which is used to distinguish this
189
-     *                                  template from others, if null it defaults to the filename+bits of the
190
-     *                                  path template from others, if null it defaults to the filename+bits
191
-     *                                  of the path template from others, if null it defaults to the
192
-     *                                  filename+bits of the path
193
-     * @param ITemplate $parentTemplate the template that is requesting a new template object (through an
194
-     *                                  include, extends or any other plugin) an include, extends or any
195
-     *                                  other plugin) an include, extends or any other plugin)
196
-     *
197
-     * @return TemplateFile|null
198
-     * @throws DwooException
199
-     * @throws SecurityException
200
-     */
201
-    public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null,
202
-                                           $compileId = null, ITemplate $parentTemplate = null)
203
-    {
204
-        if (DIRECTORY_SEPARATOR === '\\') {
205
-            $resourceId = str_replace(["\t", "\n", "\r", "\f", "\v"], [
206
-                '\\t',
207
-                '\\n',
208
-                '\\r',
209
-                '\\f',
210
-                '\\v'
211
-            ], $resourceId);
212
-        }
213
-        $resourceId = strtr($resourceId, '\\', '/');
172
+	/**
173
+	 * Returns a new template object from the given include name, null if no include is
174
+	 * possible (resource not found), or false if include is not permitted by this resource type.
175
+	 *
176
+	 * @param Core      $core           the dwoo instance requiring it
177
+	 * @param mixed     $resourceId     the filename (relative to this template's dir) of the template to
178
+	 *                                  include
179
+	 * @param int       $cacheTime      duration of the cache validity for this template, if null it defaults
180
+	 *                                  to the Dwoo instance that will render this template if null it
181
+	 *                                  defaults to the Dwoo instance that will render this template if null
182
+	 *                                  it defaults to the Dwoo instance that will render this template
183
+	 * @param string    $cacheId        the unique cache identifier of this page or anything else that makes
184
+	 *                                  this template's content unique, if null it defaults to the current
185
+	 *                                  url makes this template's content unique, if null it defaults to the
186
+	 *                                  current url makes this template's content unique, if null it defaults
187
+	 *                                  to the current url
188
+	 * @param string    $compileId      the unique compiled identifier, which is used to distinguish this
189
+	 *                                  template from others, if null it defaults to the filename+bits of the
190
+	 *                                  path template from others, if null it defaults to the filename+bits
191
+	 *                                  of the path template from others, if null it defaults to the
192
+	 *                                  filename+bits of the path
193
+	 * @param ITemplate $parentTemplate the template that is requesting a new template object (through an
194
+	 *                                  include, extends or any other plugin) an include, extends or any
195
+	 *                                  other plugin) an include, extends or any other plugin)
196
+	 *
197
+	 * @return TemplateFile|null
198
+	 * @throws DwooException
199
+	 * @throws SecurityException
200
+	 */
201
+	public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null,
202
+										   $compileId = null, ITemplate $parentTemplate = null)
203
+	{
204
+		if (DIRECTORY_SEPARATOR === '\\') {
205
+			$resourceId = str_replace(["\t", "\n", "\r", "\f", "\v"], [
206
+				'\\t',
207
+				'\\n',
208
+				'\\r',
209
+				'\\f',
210
+				'\\v'
211
+			], $resourceId);
212
+		}
213
+		$resourceId = strtr($resourceId, '\\', '/');
214 214
 
215
-        $includePath = null;
215
+		$includePath = null;
216 216
 
217
-        if (file_exists($resourceId) === false) {
218
-            if ($parentTemplate === null) {
219
-                $parentTemplate = $core->getTemplate();
220
-            }
221
-            if ($parentTemplate instanceof self) {
222
-                if ($includePath = $parentTemplate->getIncludePath()) {
223
-                    if (strstr($resourceId, '../')) {
224
-                        throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)');
225
-                    }
226
-                } else {
227
-                    $resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId;
228
-                    if (file_exists($resourceId) === false) {
229
-                        return null;
230
-                    }
231
-                }
232
-            } else {
233
-                return null;
234
-            }
235
-        }
217
+		if (file_exists($resourceId) === false) {
218
+			if ($parentTemplate === null) {
219
+				$parentTemplate = $core->getTemplate();
220
+			}
221
+			if ($parentTemplate instanceof self) {
222
+				if ($includePath = $parentTemplate->getIncludePath()) {
223
+					if (strstr($resourceId, '../')) {
224
+						throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)');
225
+					}
226
+				} else {
227
+					$resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId;
228
+					if (file_exists($resourceId) === false) {
229
+						return null;
230
+					}
231
+				}
232
+			} else {
233
+				return null;
234
+			}
235
+		}
236 236
 
237
-        if ($policy = $core->getSecurityPolicy()) {
238
-            while (true) {
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>.');
241
-                }
237
+		if ($policy = $core->getSecurityPolicy()) {
238
+			while (true) {
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>.');
241
+				}
242 242
 
243
-                if ($includePath) {
244
-                    break;
245
-                }
243
+				if ($includePath) {
244
+					break;
245
+				}
246 246
 
247
-                $resourceId = realpath($resourceId);
248
-                $dirs       = $policy->getAllowedDirectories();
249
-                foreach ($dirs as $dir => $dummy) {
250
-                    if (strpos($resourceId, $dir) === 0) {
251
-                        break 2;
252
-                    }
253
-                }
254
-                throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>');
255
-            }
256
-        }
247
+				$resourceId = realpath($resourceId);
248
+				$dirs       = $policy->getAllowedDirectories();
249
+				foreach ($dirs as $dir => $dummy) {
250
+					if (strpos($resourceId, $dir) === 0) {
251
+						break 2;
252
+					}
253
+				}
254
+				throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>');
255
+			}
256
+		}
257 257
 
258
-        $class = 'Dwoo\Template\File';
259
-        if ($parentTemplate) {
260
-            $class = get_class($parentTemplate);
261
-        }
258
+		$class = 'Dwoo\Template\File';
259
+		if ($parentTemplate) {
260
+			$class = get_class($parentTemplate);
261
+		}
262 262
 
263
-        return new $class($resourceId, $cacheTime, $cacheId, $compileId, $includePath);
264
-    }
263
+		return new $class($resourceId, $cacheTime, $cacheId, $compileId, $includePath);
264
+	}
265 265
 
266
-    /**
267
-     * Returns some php code that will check if this template has been modified or not.
268
-     * if the function returns null, the template will be instanciated and then the Uid checked
269
-     *
270
-     * @return string
271
-     */
272
-    public function getIsModifiedCode()
273
-    {
274
-        return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')';
275
-    }
266
+	/**
267
+	 * Returns some php code that will check if this template has been modified or not.
268
+	 * if the function returns null, the template will be instanciated and then the Uid checked
269
+	 *
270
+	 * @return string
271
+	 */
272
+	public function getIsModifiedCode()
273
+	{
274
+		return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')';
275
+	}
276 276
 }
Please login to merge, or discard this 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.
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.