@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | $info = FileHelper::getFolderInfo($rootFolder); |
24 | 24 | |
25 | - if(!$info->exists()) |
|
25 | + if (!$info->exists()) |
|
26 | 26 | { |
27 | 27 | return true; |
28 | 28 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | foreach ($d as $item) |
33 | 33 | { |
34 | - if(self::processDeleteItem($item) === false) |
|
34 | + if (self::processDeleteItem($item) === false) |
|
35 | 35 | { |
36 | 36 | return false; |
37 | 37 | } |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | { |
91 | 91 | $target = FileHelper::createFolder($target); |
92 | 92 | |
93 | - $d = $source->requireIsFolder()->getIterator(); |
|
93 | + $d = $source->requireIsFolder()->getIterator(); |
|
94 | 94 | |
95 | 95 | foreach ($d as $item) |
96 | 96 | { |
97 | - if($item->isDot()) |
|
97 | + if ($item->isDot()) |
|
98 | 98 | { |
99 | 99 | continue; |
100 | 100 | } |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | |
116 | 116 | if ($item->isFolder()) |
117 | 117 | { |
118 | - self::copy($item, $target . '/' . $item->getName()); |
|
118 | + self::copy($item, $target.'/'.$item->getName()); |
|
119 | 119 | } |
120 | - else if($item->isFile()) |
|
120 | + else if ($item->isFile()) |
|
121 | 121 | { |
122 | 122 | $item |
123 | 123 | ->requireIsFile() |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | try |
70 | 70 | { |
71 | 71 | FileHelper::deleteFile($itemPath); |
72 | - } |
|
73 | - catch (FileHelper_Exception $e) |
|
72 | + } catch (FileHelper_Exception $e) |
|
74 | 73 | { |
75 | 74 | return false; |
76 | 75 | } |
@@ -116,8 +115,7 @@ discard block |
||
116 | 115 | if ($item->isFolder()) |
117 | 116 | { |
118 | 117 | self::copy($item, $target . '/' . $item->getName()); |
119 | - } |
|
120 | - else if($item->isFile()) |
|
118 | + } else if($item->isFile()) |
|
121 | 119 | { |
122 | 120 | $item |
123 | 121 | ->requireIsFile() |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size. |
52 | 52 | $result = (float)preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size. |
53 | 53 | |
54 | - if($unit) |
|
54 | + if ($unit) |
|
55 | 55 | { |
56 | 56 | // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by. |
57 | 57 | return (int)round($result * (1024 ** stripos('bkmgtpezy', $unit[0]))); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param int $depth The folder depth to reduce the path to |
19 | 19 | * @return string |
20 | 20 | */ |
21 | - public static function relativizeByDepth(string $path, int $depth=2) : string |
|
21 | + public static function relativizeByDepth(string $path, int $depth = 2) : string |
|
22 | 22 | { |
23 | 23 | $path = FileHelper::normalizePath($path); |
24 | 24 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | $tokens = array_filter($tokens); // remove empty entries (trailing slash for example) |
27 | 27 | $tokens = array_values($tokens); // re-index keys |
28 | 28 | |
29 | - if(empty($tokens)) { |
|
29 | + if (empty($tokens)) { |
|
30 | 30 | return ''; |
31 | 31 | } |
32 | 32 | |
33 | 33 | // remove the drive if present |
34 | - if(strpos($tokens[0], ':') !== false) { |
|
34 | + if (strpos($tokens[0], ':') !== false) { |
|
35 | 35 | array_shift($tokens); |
36 | 36 | } |
37 | 37 | |
38 | 38 | // path was only the drive |
39 | - if(count($tokens) === 0) { |
|
39 | + if (count($tokens) === 0) { |
|
40 | 40 | return ''; |
41 | 41 | } |
42 | 42 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | |
46 | 46 | // reduce the path to the specified depth |
47 | 47 | $length = count($tokens); |
48 | - if($length > $depth) { |
|
49 | - $tokens = array_slice($tokens, $length-$depth); |
|
48 | + if ($length > $depth) { |
|
49 | + $tokens = array_slice($tokens, $length - $depth); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // append the last element again |
@@ -43,20 +43,20 @@ discard block |
||
43 | 43 | |
44 | 44 | protected FolderInfo $path; |
45 | 45 | |
46 | - /** |
|
47 | - * @var string[] |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var string[] |
|
48 | + */ |
|
49 | 49 | protected array $found = array(); |
50 | 50 | |
51 | - /** |
|
52 | - * The path must exist when the class is instantiated: its |
|
53 | - * real path will be determined to work with. |
|
54 | - * |
|
55 | - * @param string|PathInfoInterface|DirectoryIterator $path The absolute path to the target folder. |
|
56 | - * |
|
57 | - * @throws FileHelper_Exception |
|
58 | - * @see FileHelper::ERROR_PATH_IS_NOT_A_FOLDER |
|
59 | - */ |
|
51 | + /** |
|
52 | + * The path must exist when the class is instantiated: its |
|
53 | + * real path will be determined to work with. |
|
54 | + * |
|
55 | + * @param string|PathInfoInterface|DirectoryIterator $path The absolute path to the target folder. |
|
56 | + * |
|
57 | + * @throws FileHelper_Exception |
|
58 | + * @see FileHelper::ERROR_PATH_IS_NOT_A_FOLDER |
|
59 | + */ |
|
60 | 60 | public function __construct($path) |
61 | 61 | { |
62 | 62 | $this->path = AbstractPathInfo::resolveType($path)->requireExists()->requireIsFolder(); |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | ); |
75 | 75 | } |
76 | 76 | |
77 | - /** |
|
78 | - * Enables extension stripping, to return file names without extension. |
|
79 | - * |
|
80 | - * @return FileFinder |
|
81 | - */ |
|
77 | + /** |
|
78 | + * Enables extension stripping, to return file names without extension. |
|
79 | + * |
|
80 | + * @return FileFinder |
|
81 | + */ |
|
82 | 82 | public function stripExtensions() : FileFinder |
83 | 83 | { |
84 | 84 | return $this->setOption('strip-extensions', true); |
@@ -95,46 +95,46 @@ discard block |
||
95 | 95 | return $this->setOption('recursive', $enabled); |
96 | 96 | } |
97 | 97 | |
98 | - /** |
|
99 | - * Retrieves all extensions that were added to |
|
100 | - * the list of included extensions. |
|
101 | - * |
|
102 | - * @return string[] |
|
103 | - */ |
|
98 | + /** |
|
99 | + * Retrieves all extensions that were added to |
|
100 | + * the list of included extensions. |
|
101 | + * |
|
102 | + * @return string[] |
|
103 | + */ |
|
104 | 104 | public function getIncludeExtensions() : array |
105 | 105 | { |
106 | 106 | return $this->getArrayOption(self::OPTION_INCLUDE_EXTENSIONS); |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Includes a single extension in the file search: only |
|
111 | - * files with this extension will be used in the results. |
|
112 | - * |
|
113 | - * NOTE: Included extensions take precedence before excluded |
|
114 | - * extensions. If any excluded extensions are specified, they |
|
115 | - * will be ignored. |
|
116 | - * |
|
117 | - * @param string $extension Extension name, without dot (`php` for example). |
|
118 | - * @return FileFinder |
|
119 | - * @see FileFinder::includeExtensions() |
|
120 | - */ |
|
109 | + /** |
|
110 | + * Includes a single extension in the file search: only |
|
111 | + * files with this extension will be used in the results. |
|
112 | + * |
|
113 | + * NOTE: Included extensions take precedence before excluded |
|
114 | + * extensions. If any excluded extensions are specified, they |
|
115 | + * will be ignored. |
|
116 | + * |
|
117 | + * @param string $extension Extension name, without dot (`php` for example). |
|
118 | + * @return FileFinder |
|
119 | + * @see FileFinder::includeExtensions() |
|
120 | + */ |
|
121 | 121 | public function includeExtension(string $extension) : FileFinder |
122 | 122 | { |
123 | 123 | return $this->includeExtensions(array($extension)); |
124 | 124 | } |
125 | 125 | |
126 | - /** |
|
127 | - * Includes several extensions in the file search: only |
|
128 | - * files with these extensions wil be used in the results. |
|
129 | - * |
|
130 | - * NOTE: Included extensions take precedence before excluded |
|
131 | - * extensions. If any excluded extensions are specified, they |
|
132 | - * will be ignored. |
|
133 | - * |
|
134 | - * @param string[] $extensions Extension names, without dot (`php` for example). |
|
135 | - * @return FileFinder |
|
136 | - * @see FileFinder::includeExtension() |
|
137 | - */ |
|
126 | + /** |
|
127 | + * Includes several extensions in the file search: only |
|
128 | + * files with these extensions wil be used in the results. |
|
129 | + * |
|
130 | + * NOTE: Included extensions take precedence before excluded |
|
131 | + * extensions. If any excluded extensions are specified, they |
|
132 | + * will be ignored. |
|
133 | + * |
|
134 | + * @param string[] $extensions Extension names, without dot (`php` for example). |
|
135 | + * @return FileFinder |
|
136 | + * @see FileFinder::includeExtension() |
|
137 | + */ |
|
138 | 138 | public function includeExtensions(array $extensions) : FileFinder |
139 | 139 | { |
140 | 140 | $items = $this->getIncludeExtensions(); |
@@ -145,37 +145,37 @@ discard block |
||
145 | 145 | return $this; |
146 | 146 | } |
147 | 147 | |
148 | - /** |
|
149 | - * Retrieves a list of all extensions currently set as |
|
150 | - * excluded from the search. |
|
151 | - * |
|
152 | - * @return string[] |
|
153 | - */ |
|
148 | + /** |
|
149 | + * Retrieves a list of all extensions currently set as |
|
150 | + * excluded from the search. |
|
151 | + * |
|
152 | + * @return string[] |
|
153 | + */ |
|
154 | 154 | public function getExcludeExtensions() : array |
155 | 155 | { |
156 | 156 | return $this->getArrayOption(self::OPTION_EXCLUDE_EXTENSIONS); |
157 | 157 | } |
158 | 158 | |
159 | - /** |
|
160 | - * Excludes a single extension from the search. |
|
161 | - * |
|
162 | - * @param string $extension Extension name, without dot (`php` for example). |
|
163 | - * @return FileFinder |
|
164 | - * @see FileFinder::excludeExtensions() |
|
165 | - */ |
|
159 | + /** |
|
160 | + * Excludes a single extension from the search. |
|
161 | + * |
|
162 | + * @param string $extension Extension name, without dot (`php` for example). |
|
163 | + * @return FileFinder |
|
164 | + * @see FileFinder::excludeExtensions() |
|
165 | + */ |
|
166 | 166 | public function excludeExtension(string $extension) : FileFinder |
167 | 167 | { |
168 | 168 | return $this->excludeExtensions(array($extension)); |
169 | 169 | } |
170 | 170 | |
171 | - /** |
|
172 | - * Add several extensions to the list of extensions to |
|
173 | - * exclude from the file search. |
|
174 | - * |
|
175 | - * @param string[] $extensions Extension names, without dot (`php` for example). |
|
176 | - * @return FileFinder |
|
177 | - * @see FileFinder::excludeExtension() |
|
178 | - */ |
|
171 | + /** |
|
172 | + * Add several extensions to the list of extensions to |
|
173 | + * exclude from the file search. |
|
174 | + * |
|
175 | + * @param string[] $extensions Extension names, without dot (`php` for example). |
|
176 | + * @return FileFinder |
|
177 | + * @see FileFinder::excludeExtension() |
|
178 | + */ |
|
179 | 179 | public function excludeExtensions(array $extensions) : FileFinder |
180 | 180 | { |
181 | 181 | $items = $this->getExcludeExtensions(); |
@@ -186,52 +186,52 @@ discard block |
||
186 | 186 | return $this; |
187 | 187 | } |
188 | 188 | |
189 | - /** |
|
190 | - * In this mode, the entire path to the file will be stripped, |
|
191 | - * leaving only the file name in the files list. |
|
192 | - * |
|
193 | - * @return FileFinder |
|
194 | - */ |
|
189 | + /** |
|
190 | + * In this mode, the entire path to the file will be stripped, |
|
191 | + * leaving only the file name in the files list. |
|
192 | + * |
|
193 | + * @return FileFinder |
|
194 | + */ |
|
195 | 195 | public function setPathmodeStrip() : FileFinder |
196 | 196 | { |
197 | 197 | return $this->setPathmode(self::PATH_MODE_STRIP); |
198 | 198 | } |
199 | 199 | |
200 | - /** |
|
201 | - * In this mode, only the path relative to the source folder |
|
202 | - * will be included in the files list. |
|
203 | - * |
|
204 | - * @return FileFinder |
|
205 | - */ |
|
200 | + /** |
|
201 | + * In this mode, only the path relative to the source folder |
|
202 | + * will be included in the files list. |
|
203 | + * |
|
204 | + * @return FileFinder |
|
205 | + */ |
|
206 | 206 | public function setPathmodeRelative() : FileFinder |
207 | 207 | { |
208 | 208 | return $this->setPathmode(self::PATH_MODE_RELATIVE); |
209 | 209 | } |
210 | 210 | |
211 | - /** |
|
212 | - * In this mode, the full, absolute paths to the files will |
|
213 | - * be included in the files list. |
|
214 | - * |
|
215 | - * @return FileFinder |
|
216 | - */ |
|
211 | + /** |
|
212 | + * In this mode, the full, absolute paths to the files will |
|
213 | + * be included in the files list. |
|
214 | + * |
|
215 | + * @return FileFinder |
|
216 | + */ |
|
217 | 217 | public function setPathmodeAbsolute() : FileFinder |
218 | 218 | { |
219 | 219 | return $this->setPathmode(self::PATH_MODE_ABSOLUTE); |
220 | 220 | } |
221 | 221 | |
222 | - /** |
|
223 | - * This sets a character or string to replace the slashes |
|
224 | - * in the paths with. |
|
225 | - * |
|
226 | - * This is used for example in the `getPHPClassNames()` |
|
227 | - * method, to return files from subfolders as class names |
|
228 | - * using the "_" character: |
|
229 | - * |
|
230 | - * Subfolder/To/File.php => Subfolder_To_File.php |
|
231 | - * |
|
232 | - * @param string $character |
|
233 | - * @return FileFinder |
|
234 | - */ |
|
222 | + /** |
|
223 | + * This sets a character or string to replace the slashes |
|
224 | + * in the paths with. |
|
225 | + * |
|
226 | + * This is used for example in the `getPHPClassNames()` |
|
227 | + * method, to return files from subfolders as class names |
|
228 | + * using the "_" character: |
|
229 | + * |
|
230 | + * Subfolder/To/File.php => Subfolder_To_File.php |
|
231 | + * |
|
232 | + * @param string $character |
|
233 | + * @return FileFinder |
|
234 | + */ |
|
235 | 235 | public function setSlashReplacement(string $character) : FileFinder |
236 | 236 | { |
237 | 237 | return $this->setOption('slash-replacement', $character); |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | return $this->setOption(self::OPTION_PATHMODE, $mode); |
255 | 255 | } |
256 | 256 | |
257 | - /** |
|
258 | - * Retrieves a list of all matching file names/paths, |
|
259 | - * depending on the selected options. |
|
260 | - * |
|
261 | - * @return string[] |
|
262 | - */ |
|
257 | + /** |
|
258 | + * Retrieves a list of all matching file names/paths, |
|
259 | + * depending on the selected options. |
|
260 | + * |
|
261 | + * @return string[] |
|
262 | + */ |
|
263 | 263 | public function getAll() : array |
264 | 264 | { |
265 | 265 | $this->find((string)$this->path, true); |
@@ -267,24 +267,24 @@ discard block |
||
267 | 267 | return $this->found; |
268 | 268 | } |
269 | 269 | |
270 | - /** |
|
271 | - * Retrieves only PHP files. Can be combined with other |
|
272 | - * options like enabling recursion into sub-folders. |
|
273 | - * |
|
274 | - * @return string[] |
|
275 | - */ |
|
270 | + /** |
|
271 | + * Retrieves only PHP files. Can be combined with other |
|
272 | + * options like enabling recursion into sub-folders. |
|
273 | + * |
|
274 | + * @return string[] |
|
275 | + */ |
|
276 | 276 | public function getPHPFiles() : array |
277 | 277 | { |
278 | 278 | $this->includeExtensions(array('php')); |
279 | 279 | return $this->getAll(); |
280 | 280 | } |
281 | 281 | |
282 | - /** |
|
283 | - * Generates PHP class names from file paths: it replaces |
|
284 | - * slashes with underscores, and removes file extensions. |
|
285 | - * |
|
286 | - * @return string[] An array of PHP file names without extension. |
|
287 | - */ |
|
282 | + /** |
|
283 | + * Generates PHP class names from file paths: it replaces |
|
284 | + * slashes with underscores, and removes file extensions. |
|
285 | + * |
|
286 | + * @return string[] An array of PHP file names without extension. |
|
287 | + */ |
|
288 | 288 | public function getPHPClassNames() : array |
289 | 289 | { |
290 | 290 | $this->includeExtensions(array('php')); |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | return $path; |
356 | 356 | } |
357 | 357 | |
358 | - /** |
|
359 | - * Checks whether the specified extension is allowed |
|
360 | - * with the current settings. |
|
361 | - * |
|
362 | - * @param string $extension |
|
363 | - * @return bool |
|
364 | - */ |
|
358 | + /** |
|
359 | + * Checks whether the specified extension is allowed |
|
360 | + * with the current settings. |
|
361 | + * |
|
362 | + * @param string $extension |
|
363 | + * @return bool |
|
364 | + */ |
|
365 | 365 | protected function filterExclusion(string $extension) : bool |
366 | 366 | { |
367 | 367 | $include = $this->getOption(self::OPTION_INCLUDE_EXTENSIONS); |
@@ -381,12 +381,12 @@ discard block |
||
381 | 381 | return true; |
382 | 382 | } |
383 | 383 | |
384 | - /** |
|
385 | - * Adjusts the path according to the selected path mode. |
|
386 | - * |
|
387 | - * @param string $path |
|
388 | - * @return string |
|
389 | - */ |
|
384 | + /** |
|
385 | + * Adjusts the path according to the selected path mode. |
|
386 | + * |
|
387 | + * @param string $path |
|
388 | + * @return string |
|
389 | + */ |
|
390 | 390 | protected function filterPath(string $path) : string |
391 | 391 | { |
392 | 392 | switch($this->getStringOption(self::OPTION_PATHMODE)) |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @see \AppUtils\FileHelper\FileFinder |
8 | 8 | */ |
9 | 9 | |
10 | -declare(strict_types = 1); |
|
10 | +declare(strict_types=1); |
|
11 | 11 | |
12 | 12 | namespace AppUtils\FileHelper; |
13 | 13 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param bool $enabled |
91 | 91 | * @return FileFinder |
92 | 92 | */ |
93 | - public function makeRecursive(bool $enabled=true) : FileFinder |
|
93 | + public function makeRecursive(bool $enabled = true) : FileFinder |
|
94 | 94 | { |
95 | 95 | return $this->setOption('recursive', $enabled); |
96 | 96 | } |
@@ -295,22 +295,22 @@ discard block |
||
295 | 295 | return $this->getAll(); |
296 | 296 | } |
297 | 297 | |
298 | - protected function find(string $path, bool $isRoot=false) : void |
|
298 | + protected function find(string $path, bool $isRoot = false) : void |
|
299 | 299 | { |
300 | - if($isRoot) { |
|
300 | + if ($isRoot) { |
|
301 | 301 | $this->found = array(); |
302 | 302 | } |
303 | 303 | |
304 | 304 | $recursive = $this->getBoolOption('recursive'); |
305 | 305 | |
306 | 306 | $d = new DirectoryIterator($path); |
307 | - foreach($d as $item) |
|
307 | + foreach ($d as $item) |
|
308 | 308 | { |
309 | 309 | $pathname = $item->getPathname(); |
310 | 310 | |
311 | - if($item->isDir()) |
|
311 | + if ($item->isDir()) |
|
312 | 312 | { |
313 | - if($recursive && !$item->isDot()) { |
|
313 | + if ($recursive && !$item->isDot()) { |
|
314 | 314 | $this->find($pathname); |
315 | 315 | } |
316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | $file = $this->filterFile($pathname); |
321 | 321 | |
322 | - if($file !== null) |
|
322 | + if ($file !== null) |
|
323 | 323 | { |
324 | 324 | $this->found[] = $file; |
325 | 325 | } |
@@ -332,23 +332,23 @@ discard block |
||
332 | 332 | |
333 | 333 | $extension = FileHelper::getExtension($path); |
334 | 334 | |
335 | - if(!$this->filterExclusion($extension)) { |
|
335 | + if (!$this->filterExclusion($extension)) { |
|
336 | 336 | return null; |
337 | 337 | } |
338 | 338 | |
339 | 339 | $path = $this->filterPath($path); |
340 | 340 | |
341 | - if($this->getOption('strip-extensions') === true) |
|
341 | + if ($this->getOption('strip-extensions') === true) |
|
342 | 342 | { |
343 | 343 | $path = str_replace('.'.$extension, '', $path); |
344 | 344 | } |
345 | 345 | |
346 | - if($path === '') { |
|
346 | + if ($path === '') { |
|
347 | 347 | return null; |
348 | 348 | } |
349 | 349 | |
350 | 350 | $replace = $this->getOption('slash-replacement'); |
351 | - if(!empty($replace)) { |
|
351 | + if (!empty($replace)) { |
|
352 | 352 | $path = str_replace('/', $replace, $path); |
353 | 353 | } |
354 | 354 | |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | $include = $this->getOption(self::OPTION_INCLUDE_EXTENSIONS); |
368 | 368 | $exclude = $this->getOption(self::OPTION_EXCLUDE_EXTENSIONS); |
369 | 369 | |
370 | - if(!empty($include)) |
|
370 | + if (!empty($include)) |
|
371 | 371 | { |
372 | - if(!in_array($extension, $include, true)) { |
|
372 | + if (!in_array($extension, $include, true)) { |
|
373 | 373 | return false; |
374 | 374 | } |
375 | 375 | } |
376 | - else if(!empty($exclude) && in_array($extension, $exclude, true)) |
|
376 | + else if (!empty($exclude) && in_array($extension, $exclude, true)) |
|
377 | 377 | { |
378 | 378 | return false; |
379 | 379 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | protected function filterPath(string $path) : string |
391 | 391 | { |
392 | - switch($this->getStringOption(self::OPTION_PATHMODE)) |
|
392 | + switch ($this->getStringOption(self::OPTION_PATHMODE)) |
|
393 | 393 | { |
394 | 394 | case self::PATH_MODE_STRIP: |
395 | 395 | return basename($path); |
@@ -372,8 +372,7 @@ |
||
372 | 372 | if(!in_array($extension, $include, true)) { |
373 | 373 | return false; |
374 | 374 | } |
375 | - } |
|
376 | - else if(!empty($exclude) && in_array($extension, $exclude, true)) |
|
375 | + } else if(!empty($exclude) && in_array($extension, $exclude, true)) |
|
377 | 376 | { |
378 | 377 | return false; |
379 | 378 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $pathString = AbstractPathInfo::type2string($path); |
31 | 31 | |
32 | - if(!isset(self::$infoCache[$pathString])) |
|
32 | + if (!isset(self::$infoCache[$pathString])) |
|
33 | 33 | { |
34 | 34 | self::$infoCache[$pathString] = new FolderInfo($pathString); |
35 | 35 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | parent::__construct($path); |
60 | 60 | |
61 | - if(!self::is_dir($this->path)) |
|
61 | + if (!self::is_dir($this->path)) |
|
62 | 62 | { |
63 | 63 | throw new FileHelper_Exception( |
64 | 64 | 'Not a folder', |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | { |
81 | 81 | $path = trim($path); |
82 | 82 | |
83 | - if($path === '' || $path === '.' || $path === '..') |
|
83 | + if ($path === '' || $path === '.' || $path === '..') |
|
84 | 84 | { |
85 | 85 | return false; |
86 | 86 | } |
87 | 87 | |
88 | - if(is_dir($path)) |
|
88 | + if (is_dir($path)) |
|
89 | 89 | { |
90 | 90 | return true; |
91 | 91 | } |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function delete() : FolderInfo |
105 | 105 | { |
106 | - if(!$this->exists()) |
|
106 | + if (!$this->exists()) |
|
107 | 107 | { |
108 | 108 | return $this; |
109 | 109 | } |
110 | 110 | |
111 | - if(rmdir($this->path)) |
|
111 | + if (rmdir($this->path)) |
|
112 | 112 | { |
113 | 113 | return $this; |
114 | 114 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function create() : FolderInfo |
136 | 136 | { |
137 | - if(is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path)) |
|
137 | + if (is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path)) |
|
138 | 138 | { |
139 | 139 | return $this; |
140 | 140 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $path = realpath($this->path); |
96 | 96 | |
97 | - if($path !== false) |
|
97 | + if ($path !== false) |
|
98 | 98 | { |
99 | 99 | return FileHelper::normalizePath($path); |
100 | 100 | } |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | * @return $this |
114 | 114 | * @throws FileHelper_Exception |
115 | 115 | */ |
116 | - private function requireTrue(bool $condition, string $conditionLabel, ?int $errorCode=null) : self |
|
116 | + private function requireTrue(bool $condition, string $conditionLabel, ?int $errorCode = null) : self |
|
117 | 117 | { |
118 | - if($condition === true) |
|
118 | + if ($condition === true) |
|
119 | 119 | { |
120 | 120 | return $this; |
121 | 121 | } |
122 | 122 | |
123 | - if($errorCode === null) |
|
123 | + if ($errorCode === null) |
|
124 | 124 | { |
125 | 125 | $errorCode = FileHelper::ERROR_FILE_DOES_NOT_EXIST; |
126 | 126 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return $this |
138 | 138 | * @throws FileHelper_Exception |
139 | 139 | */ |
140 | - public function requireExists(?int $errorCode=null) : self |
|
140 | + public function requireExists(?int $errorCode = null) : self |
|
141 | 141 | { |
142 | 142 | return $this->requireTrue( |
143 | 143 | !empty($this->path) && realpath($this->path) !== false, |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return $this |
152 | 152 | * @throws FileHelper_Exception |
153 | 153 | */ |
154 | - public function requireReadable(?int $errorCode=null) : self |
|
154 | + public function requireReadable(?int $errorCode = null) : self |
|
155 | 155 | { |
156 | 156 | $this->requireExists($errorCode); |
157 | 157 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @return $this |
168 | 168 | * @throws FileHelper_Exception |
169 | 169 | */ |
170 | - public function requireWritable(?int $errorCode=null) : self |
|
170 | + public function requireWritable(?int $errorCode = null) : self |
|
171 | 171 | { |
172 | 172 | return $this->requireTrue( |
173 | 173 | $this->isWritable(), |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function requireIsFile() : FileInfo |
186 | 186 | { |
187 | - if($this instanceof FileInfo) |
|
187 | + if ($this instanceof FileInfo) |
|
188 | 188 | { |
189 | 189 | return $this; |
190 | 190 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function requireIsFolder() : FolderInfo |
209 | 209 | { |
210 | - if($this instanceof FolderInfo) |
|
210 | + if ($this instanceof FolderInfo) |
|
211 | 211 | { |
212 | 212 | return $this; |
213 | 213 | } |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public static function type2string($path) : string |
230 | 230 | { |
231 | - if($path instanceof PathInfoInterface) |
|
231 | + if ($path instanceof PathInfoInterface) |
|
232 | 232 | { |
233 | 233 | return $path->getPath(); |
234 | 234 | } |
235 | 235 | |
236 | - if($path instanceof DirectoryIterator) |
|
236 | + if ($path instanceof DirectoryIterator) |
|
237 | 237 | { |
238 | 238 | return $path->getPathname(); |
239 | 239 | } |
@@ -255,19 +255,19 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public static function resolveType($path) : PathInfoInterface |
257 | 257 | { |
258 | - if($path instanceof PathInfoInterface) |
|
258 | + if ($path instanceof PathInfoInterface) |
|
259 | 259 | { |
260 | 260 | return $path; |
261 | 261 | } |
262 | 262 | |
263 | 263 | $path = self::type2string($path); |
264 | 264 | |
265 | - if(FolderInfo::is_dir($path)) |
|
265 | + if (FolderInfo::is_dir($path)) |
|
266 | 266 | { |
267 | 267 | return FolderInfo::factory($path); |
268 | 268 | } |
269 | 269 | |
270 | - if(FileInfo::is_file($path)) |
|
270 | + if (FileInfo::is_file($path)) |
|
271 | 271 | { |
272 | 272 | return FileInfo::factory($path); |
273 | 273 | } |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | return $this->applyValidations($value); |
178 | 178 | } |
179 | 179 | |
180 | - /** |
|
181 | - * Runs the value through all validations that were added. |
|
182 | - * |
|
183 | - * @param mixed $value |
|
184 | - * @return mixed |
|
185 | - */ |
|
180 | + /** |
|
181 | + * Runs the value through all validations that were added. |
|
182 | + * |
|
183 | + * @param mixed $value |
|
184 | + * @return mixed |
|
185 | + */ |
|
186 | 186 | protected function applyValidations($value, bool $subval=false) |
187 | 187 | { |
188 | 188 | // go through all enqueued validations in turn, each time |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | return $value; |
196 | 196 | } |
197 | 197 | |
198 | - /** |
|
199 | - * Validates the specified value using the validation type. Returns |
|
200 | - * the validated value. |
|
201 | - * |
|
202 | - * @param mixed $value |
|
203 | - * @param string $type |
|
204 | - * @param array<string,mixed> $params |
|
205 | - * @param bool $subval Whether this is a subvalue in a list |
|
206 | - * @throws Request_Exception |
|
207 | - * @return mixed |
|
208 | - */ |
|
198 | + /** |
|
199 | + * Validates the specified value using the validation type. Returns |
|
200 | + * the validated value. |
|
201 | + * |
|
202 | + * @param mixed $value |
|
203 | + * @param string $type |
|
204 | + * @param array<string,mixed> $params |
|
205 | + * @param bool $subval Whether this is a subvalue in a list |
|
206 | + * @throws Request_Exception |
|
207 | + * @return mixed |
|
208 | + */ |
|
209 | 209 | protected function validateType($value, string $type, array $params, bool $subval) |
210 | 210 | { |
211 | 211 | $class = Request_Param_Validator::class.'_'.ucfirst($type); |
@@ -270,13 +270,13 @@ discard block |
||
270 | 270 | return $this->setValidation(self::VALIDATION_TYPE_URL); |
271 | 271 | } |
272 | 272 | |
273 | - /** |
|
274 | - * Sets the variable to contain a comma-separated list of integer IDs. |
|
275 | - * Example: <code>145,248,4556</code>. A single ID is also allowed, e.g. |
|
276 | - * <code>145</code>. |
|
277 | - * |
|
278 | - * @return $this |
|
279 | - */ |
|
273 | + /** |
|
274 | + * Sets the variable to contain a comma-separated list of integer IDs. |
|
275 | + * Example: <code>145,248,4556</code>. A single ID is also allowed, e.g. |
|
276 | + * <code>145</code>. |
|
277 | + * |
|
278 | + * @return $this |
|
279 | + */ |
|
280 | 280 | public function setIDList() : self |
281 | 281 | { |
282 | 282 | $this->valueType = self::VALUE_TYPE_LIST; |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | return $this; |
287 | 287 | } |
288 | 288 | |
289 | - /** |
|
290 | - * Sets the variable to be an alias, as defined by the |
|
291 | - * {@link RegexHelper::REGEX_ALIAS} regular expression. |
|
292 | - * |
|
293 | - * @return $this |
|
294 | - * @see RegexHelper::REGEX_ALIAS |
|
295 | - */ |
|
289 | + /** |
|
290 | + * Sets the variable to be an alias, as defined by the |
|
291 | + * {@link RegexHelper::REGEX_ALIAS} regular expression. |
|
292 | + * |
|
293 | + * @return $this |
|
294 | + * @see RegexHelper::REGEX_ALIAS |
|
295 | + */ |
|
296 | 296 | public function setAlias() : self |
297 | 297 | { |
298 | 298 | return $this->setRegex(RegexHelper::REGEX_ALIAS); |
@@ -333,12 +333,12 @@ discard block |
||
333 | 333 | return $this->setValidation(self::VALIDATION_TYPE_ALPHA); |
334 | 334 | } |
335 | 335 | |
336 | - /** |
|
337 | - * Sets the parameter value as a string containing lowercase |
|
338 | - * and/or uppercase letters, as well as numbers. |
|
339 | - * |
|
340 | - * @return $this |
|
341 | - */ |
|
336 | + /** |
|
337 | + * Sets the parameter value as a string containing lowercase |
|
338 | + * and/or uppercase letters, as well as numbers. |
|
339 | + * |
|
340 | + * @return $this |
|
341 | + */ |
|
342 | 342 | public function setAlnum() : self |
343 | 343 | { |
344 | 344 | return $this->setValidation(self::VALIDATION_TYPE_ALNUM); |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | ); |
397 | 397 | } |
398 | 398 | |
399 | - /** |
|
400 | - * Whether the parameter is a list of values. |
|
401 | - * |
|
402 | - * @return bool |
|
403 | - */ |
|
399 | + /** |
|
400 | + * Whether the parameter is a list of values. |
|
401 | + * |
|
402 | + * @return bool |
|
403 | + */ |
|
404 | 404 | public function isList() : bool |
405 | 405 | { |
406 | 406 | return $this->valueType === self::VALUE_TYPE_LIST; |
@@ -442,28 +442,28 @@ discard block |
||
442 | 442 | return $this->setValidation(self::VALIDATION_TYPE_JSON, array('arrays' => false)); |
443 | 443 | } |
444 | 444 | |
445 | - /** |
|
446 | - * The parameter is a string boolean representation. This means |
|
447 | - * it can be any of the following: "yes", "true", "no", "false". |
|
448 | - * The value is automatically converted to a boolean when retrieving |
|
449 | - * the parameter. |
|
450 | - * |
|
451 | - * @return $this |
|
452 | - */ |
|
445 | + /** |
|
446 | + * The parameter is a string boolean representation. This means |
|
447 | + * it can be any of the following: "yes", "true", "no", "false". |
|
448 | + * The value is automatically converted to a boolean when retrieving |
|
449 | + * the parameter. |
|
450 | + * |
|
451 | + * @return $this |
|
452 | + */ |
|
453 | 453 | public function setBoolean() : self |
454 | 454 | { |
455 | 455 | return $this->addClassFilter('Boolean'); |
456 | 456 | } |
457 | 457 | |
458 | - /** |
|
459 | - * Validates the request parameter as an MD5 string, |
|
460 | - * so that only values resembling md5 values are accepted. |
|
461 | - * |
|
462 | - * NOTE: This can only guarantee the format, not whether |
|
463 | - * it is an actual valid hash of something. |
|
464 | - * |
|
465 | - * @return $this |
|
466 | - */ |
|
458 | + /** |
|
459 | + * Validates the request parameter as an MD5 string, |
|
460 | + * so that only values resembling md5 values are accepted. |
|
461 | + * |
|
462 | + * NOTE: This can only guarantee the format, not whether |
|
463 | + * it is an actual valid hash of something. |
|
464 | + * |
|
465 | + * @return $this |
|
466 | + */ |
|
467 | 467 | public function setMD5() : self |
468 | 468 | { |
469 | 469 | return $this->setRegex(RegexHelper::REGEX_MD5); |
@@ -503,14 +503,14 @@ discard block |
||
503 | 503 | return $this; |
504 | 504 | } |
505 | 505 | |
506 | - /** |
|
507 | - * Retrieves the value of the request parameter, |
|
508 | - * applying all filters (if any) and validation |
|
509 | - * (if any). |
|
510 | - * |
|
511 | - * @param mixed $default |
|
512 | - * @return mixed |
|
513 | - */ |
|
506 | + /** |
|
507 | + * Retrieves the value of the request parameter, |
|
508 | + * applying all filters (if any) and validation |
|
509 | + * (if any). |
|
510 | + * |
|
511 | + * @param mixed $default |
|
512 | + * @return mixed |
|
513 | + */ |
|
514 | 514 | public function get($default=null) |
515 | 515 | { |
516 | 516 | $value = $this->request->getParam($this->paramName); |
@@ -523,17 +523,17 @@ discard block |
||
523 | 523 | |
524 | 524 | // region: Filtering |
525 | 525 | |
526 | - /** |
|
527 | - * Filters the specified value by going through all available |
|
528 | - * filters, if any. If none have been set, the value is simply |
|
529 | - * passed through. |
|
530 | - * |
|
531 | - * @param mixed $value |
|
532 | - * @return mixed |
|
533 | - * |
|
534 | - * @see RequestParam::applyFilter_callback() |
|
535 | - * @see RequestParam::applyFilter_class() |
|
536 | - */ |
|
526 | + /** |
|
527 | + * Filters the specified value by going through all available |
|
528 | + * filters, if any. If none have been set, the value is simply |
|
529 | + * passed through. |
|
530 | + * |
|
531 | + * @param mixed $value |
|
532 | + * @return mixed |
|
533 | + * |
|
534 | + * @see RequestParam::applyFilter_callback() |
|
535 | + * @see RequestParam::applyFilter_class() |
|
536 | + */ |
|
537 | 537 | protected function filter($value) |
538 | 538 | { |
539 | 539 | foreach ($this->filters as $filter) |
@@ -622,12 +622,12 @@ discard block |
||
622 | 622 | return $this; |
623 | 623 | } |
624 | 624 | |
625 | - /** |
|
626 | - * Adds a filter that trims whitespace from the request |
|
627 | - * parameter using the PHP <code>trim</code> function. |
|
628 | - * |
|
629 | - * @return $this |
|
630 | - */ |
|
625 | + /** |
|
626 | + * Adds a filter that trims whitespace from the request |
|
627 | + * parameter using the PHP <code>trim</code> function. |
|
628 | + * |
|
629 | + * @return $this |
|
630 | + */ |
|
631 | 631 | public function addFilterTrim() : self |
632 | 632 | { |
633 | 633 | // to guarantee we only work with strings |
@@ -636,13 +636,13 @@ discard block |
||
636 | 636 | return $this->addCallbackFilter('trim'); |
637 | 637 | } |
638 | 638 | |
639 | - /** |
|
640 | - * Converts the value to a string, even if it is not |
|
641 | - * a string value. Complex types like arrays and objects |
|
642 | - * are converted to an empty string. |
|
643 | - * |
|
644 | - * @return $this |
|
645 | - */ |
|
639 | + /** |
|
640 | + * Converts the value to a string, even if it is not |
|
641 | + * a string value. Complex types like arrays and objects |
|
642 | + * are converted to an empty string. |
|
643 | + * |
|
644 | + * @return $this |
|
645 | + */ |
|
646 | 646 | public function addStringFilter() : self |
647 | 647 | { |
648 | 648 | return $this->addClassFilter('String'); |
@@ -694,12 +694,12 @@ discard block |
||
694 | 694 | return $this->addCallbackFilter('strip_tags', array($allowedTags)); |
695 | 695 | } |
696 | 696 | |
697 | - /** |
|
698 | - * Adds a filter that strips all whitespace from the |
|
699 | - * request parameter, from spaces to tabs and newlines. |
|
700 | - * |
|
701 | - * @return $this |
|
702 | - */ |
|
697 | + /** |
|
698 | + * Adds a filter that strips all whitespace from the |
|
699 | + * request parameter, from spaces to tabs and newlines. |
|
700 | + * |
|
701 | + * @return $this |
|
702 | + */ |
|
703 | 703 | public function addStripWhitespaceFilter() : self |
704 | 704 | { |
705 | 705 | // to ensure we only work with strings. |
@@ -708,14 +708,14 @@ discard block |
||
708 | 708 | return $this->addClassFilter('StripWhitespace'); |
709 | 709 | } |
710 | 710 | |
711 | - /** |
|
712 | - * Adds a filter that transforms comma separated values |
|
713 | - * into an array of values. |
|
714 | - * |
|
715 | - * @param bool $trimEntries Trim whitespace from each entry? |
|
716 | - * @param bool $stripEmptyEntries Remove empty entries from the array? |
|
717 | - * @return $this |
|
718 | - */ |
|
711 | + /** |
|
712 | + * Adds a filter that transforms comma separated values |
|
713 | + * into an array of values. |
|
714 | + * |
|
715 | + * @param bool $trimEntries Trim whitespace from each entry? |
|
716 | + * @param bool $stripEmptyEntries Remove empty entries from the array? |
|
717 | + * @return $this |
|
718 | + */ |
|
719 | 719 | public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : self |
720 | 720 | { |
721 | 721 | $this->setArray(); |
@@ -746,12 +746,12 @@ discard block |
||
746 | 746 | ); |
747 | 747 | } |
748 | 748 | |
749 | - /** |
|
750 | - * Adds a filter that encodes all HTML special characters |
|
751 | - * using the PHP <code>htmlspecialchars</code> function. |
|
752 | - * |
|
753 | - * @return $this |
|
754 | - */ |
|
749 | + /** |
|
750 | + * Adds a filter that encodes all HTML special characters |
|
751 | + * using the PHP <code>htmlspecialchars</code> function. |
|
752 | + * |
|
753 | + * @return $this |
|
754 | + */ |
|
755 | 755 | public function addHTMLSpecialcharsFilter() : self |
756 | 756 | { |
757 | 757 | return $this->addCallbackFilter('htmlspecialchars', array(ENT_QUOTES, 'UTF-8')); |
@@ -764,14 +764,14 @@ discard block |
||
764 | 764 | return $this->paramName; |
765 | 765 | } |
766 | 766 | |
767 | - /** |
|
768 | - * Marks this request parameter as required. To use this feature, |
|
769 | - * you have to call the request's {@link Request::validate()} |
|
770 | - * method. |
|
771 | - * |
|
772 | - * @return RequestParam |
|
773 | - * @see Request::validate() |
|
774 | - */ |
|
767 | + /** |
|
768 | + * Marks this request parameter as required. To use this feature, |
|
769 | + * you have to call the request's {@link Request::validate()} |
|
770 | + * method. |
|
771 | + * |
|
772 | + * @return RequestParam |
|
773 | + * @see Request::validate() |
|
774 | + */ |
|
775 | 775 | public function makeRequired() : RequestParam |
776 | 776 | { |
777 | 777 | $this->required = true; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @return $this |
125 | 125 | * @throws Request_Exception |
126 | 126 | */ |
127 | - public function setCallback(callable $callback, array $args=array()) : self |
|
127 | + public function setCallback(callable $callback, array $args = array()) : self |
|
128 | 128 | { |
129 | 129 | return $this->setValidation( |
130 | 130 | self::VALIDATION_TYPE_CALLBACK, |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | // first off, apply filtering |
150 | 150 | $value = $this->filter($value); |
151 | 151 | |
152 | - if($this->valueType === self::VALUE_TYPE_LIST) |
|
152 | + if ($this->valueType === self::VALUE_TYPE_LIST) |
|
153 | 153 | { |
154 | - if(!is_array($value)) |
|
154 | + if (!is_array($value)) |
|
155 | 155 | { |
156 | 156 | $value = explode(',', $value); |
157 | 157 | } |
158 | 158 | |
159 | 159 | $keep = array(); |
160 | 160 | |
161 | - foreach($value as $subval) |
|
161 | + foreach ($value as $subval) |
|
162 | 162 | { |
163 | 163 | $subval = $this->filter($subval); |
164 | 164 | |
165 | 165 | $subval = $this->applyValidations($subval, true); |
166 | 166 | |
167 | - if($subval !== null) { |
|
167 | + if ($subval !== null) { |
|
168 | 168 | $keep[] = $subval; |
169 | 169 | } |
170 | 170 | } |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param mixed $value |
184 | 184 | * @return mixed |
185 | 185 | */ |
186 | - protected function applyValidations($value, bool $subval=false) |
|
186 | + protected function applyValidations($value, bool $subval = false) |
|
187 | 187 | { |
188 | 188 | // go through all enqueued validations in turn, each time |
189 | 189 | // replacing the value with the adjusted, validated value. |
190 | - foreach($this->validations as $validateDef) |
|
190 | + foreach ($this->validations as $validateDef) |
|
191 | 191 | { |
192 | 192 | $value = $this->validateType($value, $validateDef['type'], $validateDef['params'], $subval); |
193 | 193 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | { |
211 | 211 | $class = Request_Param_Validator::class.'_'.ucfirst($type); |
212 | 212 | |
213 | - if(!class_exists($class)) |
|
213 | + if (!class_exists($class)) |
|
214 | 214 | { |
215 | 215 | throw new Request_Exception( |
216 | 216 | 'Unknown validation type.', |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | { |
362 | 362 | $args = func_get_args(); // cannot be used as function parameter in some PHP versions |
363 | 363 | |
364 | - if(is_array($args[0])) |
|
364 | + if (is_array($args[0])) |
|
365 | 365 | { |
366 | 366 | $args = $args[0]; |
367 | 367 | } |
@@ -511,10 +511,10 @@ discard block |
||
511 | 511 | * @param mixed $default |
512 | 512 | * @return mixed |
513 | 513 | */ |
514 | - public function get($default=null) |
|
514 | + public function get($default = null) |
|
515 | 515 | { |
516 | 516 | $value = $this->request->getParam($this->paramName); |
517 | - if($value !== null && $value !== '') { |
|
517 | + if ($value !== null && $value !== '') { |
|
518 | 518 | return $value; |
519 | 519 | } |
520 | 520 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | { |
539 | 539 | foreach ($this->filters as $filter) |
540 | 540 | { |
541 | - $method = 'applyFilter_' . $filter['type']; |
|
541 | + $method = 'applyFilter_'.$filter['type']; |
|
542 | 542 | $value = $this->$method($value, $filter['params']); |
543 | 543 | } |
544 | 544 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | $filter = new $class($this); |
559 | 559 | |
560 | - if($filter instanceof Request_Param_Filter) |
|
560 | + if ($filter instanceof Request_Param_Filter) |
|
561 | 561 | { |
562 | 562 | $filter->setOptions($config['params']); |
563 | 563 | return $filter->filter($value); |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | * @param bool $stripEmptyEntries Remove empty entries from the array? |
717 | 717 | * @return $this |
718 | 718 | */ |
719 | - public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : self |
|
719 | + public function addCommaSeparatedFilter(bool $trimEntries = true, bool $stripEmptyEntries = true) : self |
|
720 | 720 | { |
721 | 721 | $this->setArray(); |
722 | 722 | |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | * @return $this |
736 | 736 | * @throws Request_Exception |
737 | 737 | */ |
738 | - protected function addClassFilter(string $name, array $params=array()) : self |
|
738 | + protected function addClassFilter(string $name, array $params = array()) : self |
|
739 | 739 | { |
740 | 740 | return $this->addFilter( |
741 | 741 | self::FILTER_TYPE_CLASS, |
@@ -24,9 +24,9 @@ |
||
24 | 24 | { |
25 | 25 | use Traits_Optionable; |
26 | 26 | |
27 | - /** |
|
28 | - * @var RequestParam |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var RequestParam |
|
29 | + */ |
|
30 | 30 | protected $param; |
31 | 31 | |
32 | 32 | protected $value; |
@@ -29,14 +29,14 @@ |
||
29 | 29 | */ |
30 | 30 | protected $param; |
31 | 31 | |
32 | - /** |
|
33 | - * @var mixed |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var mixed |
|
34 | + */ |
|
35 | 35 | protected $value; |
36 | 36 | |
37 | - /** |
|
38 | - * @var bool |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var bool |
|
39 | + */ |
|
40 | 40 | protected $isSubvalue = false; |
41 | 41 | |
42 | 42 | public function __construct(RequestParam $param, bool $subval) |