@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Sets the file to store for later |
44 | 44 | * |
45 | - * @param mixed $file |
|
45 | + * @param false|string $file |
|
46 | 46 | * The file to set |
47 | 47 | * @param bool $reset |
48 | 48 | * Whether the counter should be reset when set |
49 | - * @return \mithra62\Files |
|
49 | + * @return Files |
|
50 | 50 | */ |
51 | 51 | public function setFileData($file = false, $reset = false) |
52 | 52 | { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @param string $file |
93 | 93 | * The path to the file to read |
94 | - * @return boolean|string |
|
94 | + * @return false|string |
|
95 | 95 | */ |
96 | 96 | public function read($file) |
97 | 97 | { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * Removes a file from the file system |
107 | 107 | * |
108 | 108 | * @param string $path |
109 | - * @return bool |
|
109 | + * @return boolean|null |
|
110 | 110 | */ |
111 | 111 | public function delete($path) |
112 | 112 | { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param string $path |
124 | 124 | * @param string $del_dir |
125 | - * @param number $level |
|
125 | + * @param integer $level |
|
126 | 126 | * @param array $exclude |
127 | 127 | * @return boolean |
128 | 128 | */ |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @param string $val |
166 | 166 | * The number to format |
167 | - * @param number $digits |
|
167 | + * @param integer $digits |
|
168 | 168 | * How many digits to display |
169 | 169 | * @param string $mode |
170 | 170 | * Either SI or EIC to determine either 1000 or 1024 bytes |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function write($path, $data, $mode = 'w+') |
76 | 76 | { |
77 | - if (! $fp = @fopen($path, $mode)) { |
|
78 | - throw new FileException('Can\'t open the file for writing! ' . $path); |
|
77 | + if (!$fp = @fopen($path, $mode)) { |
|
78 | + throw new FileException('Can\'t open the file for writing! '.$path); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | flock($fp, LOCK_EX); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function read($file) |
97 | 97 | { |
98 | - if (! file_exists($file)) { |
|
98 | + if (!file_exists($file)) { |
|
99 | 99 | return FALSE; |
100 | 100 | } |
101 | 101 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | // Trim the trailing slash |
132 | 132 | $path = rtrim($path, DIRECTORY_SEPARATOR); |
133 | 133 | |
134 | - if (! $current_dir = @opendir($path)) { |
|
134 | + if (!$current_dir = @opendir($path)) { |
|
135 | 135 | return false; |
136 | 136 | } |
137 | 137 | |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | $exclude[] = '..'; |
140 | 140 | |
141 | 141 | while (false !== ($filename = @readdir($current_dir))) { |
142 | - if (! in_array($filename, $exclude)) { |
|
143 | - if (is_dir($path . DIRECTORY_SEPARATOR . $filename)) { |
|
142 | + if (!in_array($filename, $exclude)) { |
|
143 | + if (is_dir($path.DIRECTORY_SEPARATOR.$filename)) { |
|
144 | 144 | if (substr($filename, 0, 1) != '.') { |
145 | - $this->deleteDir($path . DIRECTORY_SEPARATOR . $filename, $del_dir, $level + 1, $exclude); |
|
145 | + $this->deleteDir($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1, $exclude); |
|
146 | 146 | } |
147 | 147 | } else { |
148 | - $this->delete($path . DIRECTORY_SEPARATOR . $filename); |
|
148 | + $this->delete($path.DIRECTORY_SEPARATOR.$filename); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $bB = "B"; |
219 | 219 | break; |
220 | 220 | } |
221 | - for ($i = 0; $i < count($symbols) - 1 && $val >= $factor; $i ++) { |
|
221 | + for ($i = 0; $i < count($symbols) - 1 && $val >= $factor; $i++) { |
|
222 | 222 | $val /= $factor; |
223 | 223 | } |
224 | 224 | $p = strpos($val, "."); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $val = round($val, $digits - $p); |
229 | 229 | } |
230 | 230 | |
231 | - return round($val, $digits) . " " . $symbols[$i] . $bB; |
|
231 | + return round($val, $digits)." ".$symbols[$i].$bB; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | $file_extension = strtolower(substr(strrchr($filename, "."), 1)); |
248 | 248 | |
249 | 249 | if ($filename == "") { |
250 | - throw new FileException('Download file NOT SPECIFIED! ' . $filename); |
|
251 | - } elseif (! file_exists($filename)) { |
|
252 | - throw new FileException('Download file NOT Found! ' . $filename); |
|
250 | + throw new FileException('Download file NOT SPECIFIED! '.$filename); |
|
251 | + } elseif (!file_exists($filename)) { |
|
252 | + throw new FileException('Download file NOT Found! '.$filename); |
|
253 | 253 | } |
254 | 254 | ; |
255 | 255 | switch ($file_extension) { |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
295 | 295 | header("Cache-Control: private", false); |
296 | 296 | header("Content-Type: $ctype"); |
297 | - header("Content-Disposition: attachment; filename=\"" . ($force_name ? $force_name : basename($filename)) . "\";"); |
|
297 | + header("Content-Disposition: attachment; filename=\"".($force_name ? $force_name : basename($filename))."\";"); |
|
298 | 298 | header("Content-Transfer-Encoding: binary"); |
299 | - header("Content-Length: " . $filesize); |
|
299 | + header("Content-Length: ".$filesize); |
|
300 | 300 | |
301 | 301 | if ($fd = fopen($filename, "r")) { |
302 | - while (! feof($fd)) { |
|
302 | + while (!feof($fd)) { |
|
303 | 303 | $buffer = fread($fd, 1024 * 8); |
304 | 304 | echo $buffer; |
305 | 305 | } |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | // reset the array and make sure $source_dir has a trailing slash on the initial call |
327 | 327 | if ($recursion === false) { |
328 | 328 | $this->setFileData(false, true); |
329 | - $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
329 | + $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | while (false !== ($file = readdir($fp))) { |
333 | - if (@is_dir($source_dir . $file) && strncmp($file, '.', 1) !== 0) { |
|
334 | - $this->getFilenames($source_dir . $file . DIRECTORY_SEPARATOR, $include_path, TRUE); |
|
333 | + if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0) { |
|
334 | + $this->getFilenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE); |
|
335 | 335 | } elseif (strncmp($file, '.', 1) !== 0) { |
336 | - $filedata = ($include_path == TRUE) ? $source_dir . DIRECTORY_SEPARATOR . $file : $file; |
|
336 | + $filedata = ($include_path == TRUE) ? $source_dir.DIRECTORY_SEPARATOR.$file : $file; |
|
337 | 337 | $this->setFileData($filedata); |
338 | 338 | } |
339 | 339 | } |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(trim($dir), \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) { |
358 | 358 | |
359 | 359 | if ($item->isDir()) { |
360 | - mkdir($destination . DIRECTORY_SEPARATOR . $iterator->getSubPathName(), '0777', true); |
|
360 | + mkdir($destination.DIRECTORY_SEPARATOR.$iterator->getSubPathName(), '0777', true); |
|
361 | 361 | } else { |
362 | - copy($item, $destination . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); |
|
362 | + copy($item, $destination.DIRECTORY_SEPARATOR.$iterator->getSubPathName()); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | } |